The D40x is going for under $650 new on Amazon.
Production already stopped by Nikon, something new apparently on the way ... and this always was an odd niche lacking the AF screw-drive motor.
The D50 has held value far better because of this. It's successors weren't as functional.
Unfortunately, camera bodies reach a point where values drop precipitously... the D40/40x series isn't quite there yet since there isn't a 'replacement' out yet but informed buyers are expecting something and those wanting more functionality can pick up used D80's for not much more than this.
Got a used D50 to replace my wife's D40 - better functionality and ability to use more lenses. Didn't even try to sell the 40, she keeps it as a 'casual carry' - a step above P&S but carries the 50 when she's serious about shooting (she likes the size/weight range).
Good luck in selling but you may find that it has more value as a back-up. You're not going to be able to replace it with anything as nice for what you're going to sell it for.