I have a Nikon D40X and I cant decide if I should upgrade my camera body or upgrade from a AF-S DX Nikkor 18-200mm to whatever else might be recommended?
Glass tends to last longer than bodies, so I generally use a camera body as long as it meets my needs and invest in glass when I can. Then when I get a better body I have better glass that I can still use with it. If you are going to invest in glass I do recommend investing in glass that will work on a full frame body because chances are decent you may decide to move to full frame after you have a decent collection of optics.
So my short answer is upgrade the camera body when you need features in a new body that it doesn't have and invest in optics when you want to expand the capabilities of both your current and future camera bodies.
I will base an answer on assumptions:
So my take on it is this:
If your body is at least 10MP it is fine for making great 1-2mp (screen) and A4 prints 300DPI. If it is from at least anno 2009 the sensor tech is fine. Earlier than that , it is time to upgrade. Your camera is 10MP and younger than that, so you should only upgrade it if you need the new fancy features (that do not make better images) on newer DX cameras, or if you upgrade to a FX model.
A superzoom lens (18-200mm) is made for convenience and for point and shoot upgraders who wont sacrifice that convenience, but they do not make great lenses. I ti really hard to make a wide angle and tele in the same lens as it is two different design strategies. It will only be sort of sharp in a specific f-range.
So you should upgrade your lens to fast primes for better image quality, narrow DOF, and low light flashless shooting, fixed aperture standard zoom (approx 18-50mm F2.8) for convenient control, and approx 70-300 telezoom for reach.
For primes you can do a 24-28mm as a walkaround prime, 35-50mm for full body shots, 85mm for portraits.
If you like macro photography look for a 60mm 2.8 macro.