I don't have either, but I've heard great things about both. They both take nice pictures, I know some people who own each one. I'd personally go for the D40, as it's quite a bit cheaper, especially if this is your first DSLR. Also, try maybe googling them to see if you can find any comparison articles. Take a close look at the specs, see if there's a feature of one you really like (higher megapixel rating, whatever.)
Ultimately, though, it's your choice. You must choose wisely.