At the end of the day you couldnt go wrong with either of those cameras. I'd go woth which ever is chaeper at the end of the day tbh, although they seem to be much the same currently.
I will say as someone who has both cameras at thier disposal (sister has D40X & I the 400D) I prefere the EOS400D because of the extra buttons which alow quick adjustment of ISO,WB, AF and metering modes amoung other things (you can program the Fn button on the D40x to be ISO). Also you have a depth of field preview button, hold this and the lens stops down to the indicated aperture to give a preview of the depth of field through the viewfinder. Not an amazing feature, but one I've used a few times now. Another good feature the D40X doesnt have is the option to shoot RAW+Fine,JPG. Also the D40X doesnt alow exposure bracketing for JPG, again not a biggy especially as I only shoot raw now mostly.
Enjoy your new camera fella whichever you choose