Heidilyn - As a general rule, the only lenses that won't work on a D90 and that do work on a D40 are the pre-AI lenses from say 1970 or so and earlier. These are all the manual focus, non-CPU, non-metering type lenses.
You thinking about a new camera, perhaps?