Get
a DoF calculator. It simplifies things drastically. (I blew $1.99 on the AppStore for DoFMaster on the iPhone/iPodTouch.

) You can also print out and use charts, but check that any "for digital" charts you're using are for the sensor size of your camera (i.e., don't use a Nikon one if you're on a Canon crop and vice versa).
Enter in:
- Your sensor size
- Your focal length
- Your aperture
The calculator will spit back your hyperfocal distance. Set your lens to focus at that distance (this is nearly impossible to do accurately, btw, without a distance scale. If you're using an 18-55 kit lens, you don't have a distance scale, and this may be the main reason why you're having problems).
Everything from
half the hyperfocal distance to infinity should be in focus,
if a hyperfocal distance could be found.
With some focal length and aperture combinations, you may not be able to achieve a useful hyperfocal distance (i.e., with a very long lens, and a very wide aperture, DoF will be limited so that it can't reach infinity).
So, for example, if I'm using my Canon XT, and my 135L, if I set the lens to f/2, there is no hyperfocal distance. If I set the same lens to f/11, my hyperfocal distance is 278.6 ft. Which is only going to get me everything from 139.3 ft. to infinity in focus. Not exactly useful. If, otoh, I'm using my 18-55 kit @18mm, set to f/8, my hyperfocal distance is 7.05 ft, and everything from 3.53 ft. to infinity will be in focus, and that's far more useful.
Achieving what you're asking for: near foreground and infinity in focus, is going to require a pretty wide lens and a relatively small aperture setting, and it's
not a given that simply finding the hyperfocal distance will always do it. This is why some of us also lust after
tilt-shift lenses.
Another tool you may want to consider using to help you judge DoF, if your camera has one, is the DoF preview button. If you're shooting a Canon dSLR, you have one, but if you're shooting with an entry-level Nikon (e.g., D40/D60), you don't. But essentially when you look through the viewfinder your lens is wide open. This is so you have the most light to see by to compose and focus, but the DoF shown is inaccurate for the picture you're about to take if you're not using your lens's maximum aperture. The DoF preview button stops down the lens to your aperture setting. The viewfinder will get darker, because you're looking through a smaller hole, but the DoF will be accurate to judge for composition.