More fun on NikonUSA
> Will my D40 lenses fit the D5100 or D7000?
> Subject says it all–will my D40 lenses fit the D5100 or D7000? And how, in general, can one tell which lenses will fit which cameras?
The short answer is: Yes, all lenses that “fit” your D40 will fit the D5100 D7000 and later Nikon dSLRs with an F-mount (that’s currently all Nikons dSLRs).
The only Nikon F mount lenses that will not fit on these cameras are some that were designed to operate with the mirror up and had different box dimensions. These mounts would crash the reflex mirror. Fortunately there are very few of these lenses around and most are collectors items so you won’t run into it. A quick google will warn you if this is the case.
But what you are really asking is do they mount and work the same? The answer is still: Yes, but with one exception. Nikon lenses with a “G” designation but not an “AF-S” one will not auto-focus on the D5100 or D7000, but will on the D40. Fortunately, there are very few lenses that qualify for that, and those that do are low-end lenses that have since been replaced by better/cheaper models—the only time you have to worry is when someone is trying to pawn off a dud second-hand.
Note that any old AF lenses you purchase for the D40 will now auto-focus on the D7000. Whereas before they didn’t at all because the latter has an in-body motor while the former does not. You do lose matrix metering capability vs. the D40, but most people will take AF over the matrix meter.
As for understanding the smorgasbord of compatibility, [Nikonians has a friendly chart](http://www.nikonians.org/nikon/slr-lens.html). (There may be a slight error. I don’t believe the D5100 has an AF motor in it.)
Another thing to note is that where the Nikonians chart has a big “No!” for pre-AI lenses, you can use a [John White’s conversion service](http://www.aiconversions.com/) to “upgrade” the pre-1977 lenses to an AI lens so that the aperture functions correctly when the shutter is pressed. (These lenses, with the exception mentioned above will mount, but they the aperture controls won’t be automatic.)
This is one of the strengths and pitfalls of the Nikon system. Nikon has decided to ensure mount compatibility for the F mount since its inception (it predates Pentax and Canon). But advances in technology need to be incorporated into the lenses also. Other companies either break backward compatibility across the line or are slow to implement new features to ensure body/lens compatibility at the right price. Nikon splits this difference with deciding how much of the old lens suite to build in the camera based on the price point/budget and usage scenario (size/weight) of its typical shooters.