In a large saucepan melt margarine or butter; stir in flour. Add milk all at once. Cook and stir until bubbly; cook and stir 1 minute more. Remove from heat. Stir 1 cup of the hot mixture into beaten eggs; return mixture to saucepan. Stir in cheddar cheese, sherry and/or milk, mustard, nutmeg, and pepper. Set aside.
In a large skillet cook onion in hot oil about 5 minutes or until tender. Stir in spinach; set aside.
Place half of the ham in an ungreased 2-quart rectangular baking dish or casserole. Break up hash brown patties and place half atop ham. Spoon half of the cheese sauce atop potatoes. Spoon the spinach mixture atop cheese sauce in dish. Repeat layers with remaining ham, potatoes, and sauce. Sprinkle with Parmesan cheese.
Bake, uncovered, in a 350 degree F oven for 30 minutes. Let stand 10 minutes before serving. Makes 8 servings.