Difficult question, there are so many other cams to choose from..(D80??). I think both cams will work fine, i'm working with the d40x and still are satisfied with it. The main problem is that the autofocus engine is in the lens, so buying a new lens is a problem gonna cost you some extra money. Image quality is good, check my blog. Some people say d40 has better colors as the d40x. I do not think so, d40x colors are a bit to saturated but i like it

and you can adjust them on your cam. Difference between a 6 mp and a 10 mp will show in cropping your picture.
I do not know much about cams but i'm using one, thats all.
Perhaps you can get a bargain now with the d40 on sale..
I do not know the price difference between a d40 an d40x at your place.
Greetings Jan