Most older Nikon lenses can be used on the lower-end Nikon bodies. The D40 series, the D60, and the D5000 will all mount,and shoot pictures with, basically
ANY conventional Nikkor lens, even the pre-AI ones made from 1959 to 1977, as well as all Ai and AiS manual focus lenses made from 1977 to the present, as well as all AF, AF-i,AF-D,and AF-S, and AF-S G series lenses.
The lower end bodies like the D40,D60,D5000 will only give you autofocusing and light metering when using the newer AF-S or AF-S G series lenses.
Nikon has been making SLR bodies and SLR lenses for fifty years now,so if you have a specific question, it is always best to ask about a specific body,or bodies, if you want a definitive or complete answer.