Can I get a zoom lens with an aperture ring for a nikon d40?

I would like to be able to adjust the aperture with a ring on the lens instead of inside the camera, just like the old film cameras

A Nikon lens with an aperture ring will not auto focus on your D40. Only 3 such zoom lenses are shown on the Nikon lens web page:
AF 18-35mm f3.5-4.5D
AF 24-85mm f2.8-4.0D
AF 80-400mm f4.5-5.6D
Your D40 needs Nikon's AF-S lenses if you want auto focus and the AF-S lenses don't have an aperture ring on the lens.

Well, not if you want to autofocus. Any AF or AF-D lens will have an aperture ring but your nikon doesn't like you doing that so you'd be in full manual all the time.