What is the highest capacity SDHC memory card that will work in my Nikon D 40 camera?
According to Nikon's support page, Approved SD cards for D40, 4 GB is the highest-capacity supported SDHC cards. And note, "Other brands and capacities of cards may work, but Nikon cannot guarantee their operation."
The SDHC standard supports capacities up to 32 GB. But when the D40 was announced in late 2006, very few SDHC were probably available. Hence, the only cards available when the approved support list was written were max 4GB.
D40 users have reported their camera works fine with 32 GB SDHC cards.