If the lens just keeps going back and forth but wont lock onto anything it's ussually because you are too close to what you're trying to snap a picture of, back upa little and see what happens. You can just flick the switch on the side of those nikkor lens and put it into manual. With some other lens you have to switch it in the camera to manual.
Also, if you look through the lens you see three little squares. Those are your focus points (they're also there for the exposure points when using the built in light meter). But for focus, just use the little selector (joy stick) thing on the back to highlight which one you want to use (I don't know the correct name for it, it's the cross thing with the "ok" in the middle).
You might have it set to focus on the right or left side, while you're lookign at something in the middle and it's trying to focus on a different place then what you want.