Tell us some more! Your answer needs to include more details to help people.You can't post answers that contain an email address.Please enter a valid email address.The email address entered is already associated to an account.Login to postPlease use English characters only.

It sounds like you need a new lens. This particular camera does not have an autofocus motor built in, which means it can only use lenses that have a motor already built in. Look for any Nikon lenses that have the AF-S in their name.

The D40x only autofocuses with the latest AF-S (and old professional AF-I) lenses. Most traditional (screw-type) AF lenses from 1986 through today will not autofocus on the D40x. If your lens says "AF-S," you're fine.
Most lenses sold today for the D40x are AF-S, and so is the included 18-55mm kit lens. Many non-Nikon lenses from Tamron, Tokina, Quantaray, Sigma and anyone other than Nikon still won't autofocus on the D40x. Try before you buy, but honestly, there isn't much the included 18-55mm lens won't do.
Autofocus systems are fast, but not usually instantaneous. You have to hold the shutter down halfway as you compose the first shot so the AF system can focus and lock, and then the camera fires instantaneously when you press the shutter the rest of the way. See Preventing Shutter Delay for more.

You need AF-S or AF-I Lenses. These have the autofocus motor built in to the lense. The D40 and D40x does not have an autofocus motor in the camera body itself, while the D80, D300, D3 Etc to have the motor in the camera. You can use most old lenses on your D40x, but you will have to focus them manually.

See Ken Rockwells page for a lot of D40 / D40x infohttp://www.kenrockwell.com/nikon/d40.htm

I had the same problem. My issue was with all my lenses. I solved it by going to the menu and selecting the custom setting menu (pencil icon). Then from the right menu select the AE-L/AF-L and press OK. Then make sure it is set on AE/AF Lock. Presto...all my lenses worked on auto-focus.