The D40 and the D40x do have some draw backs, such as not being compatible with some of the older auto focus lenses, such as the old AF-i series. All of the newer AF-s lenses will be fine. Also, It only has one auto focus seneor. I have big paws so the bigger bodies of the D80 and the D200 work better for me, as well as the displays being at my eye, so I can keep track of my subject and change ISO, aperture, shutter speed etc. at the same time. I have found this to be VERY useful over the D50, Which is pretty much what a D40 is, minus and plus a few things, such as an RGB histogram and A bigger and better LCD.
I looked at the D40 to buy my father for his birthday this year. He is a semi serious photographer that has a few lenses and an old Nikon film camera, so this was his first SLR. The D80 just had more B's and W's and advantages over the D40, especially if he was to get a little more serious, which sometimes happens with retirement. It was twice the price, but he ended up with the D80.
The biggest difference between the D80 and the D200 IMO, is that the D200 makes you learn everything about Camera functions. It is almost 100% manual, and admittedly, may take more time to take decent pictures, You can get great pictures from the D40 out of the package and with no prior knowledge of SLR photography.
I will whole heartedly agree with thresher on the composition etc. It doesn't matter if you have 20k worth of photo equipment if you can't compose a picture or have no clue how light will affect your photos.
IMO, both decent equipment and A fair grasp of "the rules" (which are meant to be broken)are required. But hey, I only know about 3% of what I could about this stuff, that's why we discuss it right?
The best advice I ever got was to take as many photos as I can, only then can you figure out what YOU like, what mistakes YOU make and How YOU can remedy them and get some great accidents in the meantime!