over a year agosvitekphotos recommends neither camera
Neither.
The D90 has good megapixel count, but its a very slow CMOS sensorplate. The D40, meanwhile, has a 6MP CCD sensor, which is much faster and more reliable.
Overall, I'd pick neither and go with an S3 pro.
(The D90 has a slight edge tho)