This is a good question and the internet is full of advice (some good, some bad) about the 40 vs 9mm debate.
What the previous posts show is true (capacity, recoil, etc.)
For me, I found that a .40 in a subcompact frame (any given brand) is a bit snappy - not hallacious, but just snappy. I'm not really recoil sensitive, but I like the controlability of a 9mm. In any medium or full size frame, I'll take either without any problem.
** I don't know where you guys are getting your ammo, but the .40 is costing me 20%-25% more than the 9mm in cheap/plinking FMJ ammo. In self-defense rounds, prices are similar and you could expect to pay .80-$1 per shot.