Why does the oil pressure light come on when the car is put into gear from idle then go off when accelerating?

Oil pressure lights work off the pressure of oil in the engine. When the car is idleing and out of gear the engine is turning a certain RPM (Rounds Per Minute). The speed that it is turning is fast enough to keep the oil pressure at a level high enough not to trigger the light. When you place the car in gear, the engine slows down and thus the oil pressure drops to a point low enough to trigger the light. Once you accelerate, the speed of the engine increases and brings up the oil pressure. Now, the cause of this could be numerous. First make sure you have plenty of oil as this is the least expensive to fix. The oil could be too thick and needs to be changed to solve this change the oil if it's been a while. Finally there could be several mechanical reasons for low oil pressure such as a bad oil pump (not likely), clogged oil lines/ports, worn main bearings, clogged return oil ports from the heads. None of these last things are cheap to fix. However, if it's a motor with clogged oil ports (thick oil, gunk on the inside of the valve cover, etc) there are products that will disolve it that you can flush the motor with and then change the oil. This 'fix' can sometimes cause more problems to crop up and should be used as a last resort. Good luck.