Why does my honda odyssey rev up by itself in park?

The "D" (drive) light flashes sometimes too, and I coded it and this came up "P1740"

The idle problem is cause by a defected ICV (Idle Control Valve). You can try to remove it and clean it out with carburetor cleaner.

Do you have any shifting problem? Is there any other code besides the P1740? It is a fourth clutch trans fluid pressure switch (P1740), the part is about $50 and make sure you use Honda ATF fluid or the ones approved by Honda. This link will show you how and its location.
http://www.justanswer.com/honda/15qtp-2002-honda-parts-need-fault-codes.html

Edit: Hope it'll take care of the problem as the success rate is about 3 out of 4. If not, the transmission will need to be rebuilt.

Why did you not capitalize your very own name, "jack?" How come you did not capitalize the proper names of Honda and Odyssey? Why did you not place a required punctuation mark at the end of the statement? We all have issues, "jack." I really am opposed to this texting trend of "convenient English, "jack" and if you are not a mechanic nor have the training as to codes and repairs, why are you asking? There's nothing you could do. THE only answer, Jack, is to take the Honda Odyssey to a certified mechanic for repairs. All the answers provided as guesses and guesses nor non certified mechanics have never fixed mechanical issues with cars or other machines. As to the Honda, in your youthful lack of experience you failed to properly identify the year of the vehicle and the miles. All important data points. Since 16 year old kids do not drive Honda Odysseys I do wonder as to your age and experience. I do not recommend you do anything but to drive the car to an auto technician and ask that you please write correctly using English grammar standards.

4th gear pressure switch.

http://www.hondapartssales.com/lisle/jsp/item.jsp?srchwords=28600-P7W-003