Could be lots of things. First question, is it only in D it doesn't work? Or does it not work in any position (R, L2, L1)?
With any automatic problem, the first thing to check is the fluid level. Low fluid can cause a host of complaints.
2nd, check the detent cable (or it's equivalent). Perhaps the shifter isn't "communicating" with the transmission.