In a big skillet, heat oil at medium heat. Add onion, garlic and cook, stirring from time to time, for about 5 minutes or until onion has soften. Add mushrooms, sherry or wine and cook for about 5 minutes or until mushrooms have soften. Sprinkle with flour and stir.
With a whisk, add milk slowly and keep cooking, stirring from time to time, for about 12 minutes or until the sauce has thicken. Add ham, parsley, salt and pepper and stir.
In the meantime, in a big casserole with boiling salted water, cook pasta 8 to 10 minutes or until al dente. Drain pasta and put back in the casserole. Add the mushrooms and ham sauce and stir to coat well.