I just recently replaced the oil pan gasket and now when the car is idled the light comes on.But once I accelerate it goes off the cars drives fine otherwise. My fiest inclination is to change the oil pressure sensor. Am I on the right track.
Oil light questions on 1999 Ford Taurus
If the problem happened right after the oil pan work, you may have accidentally moved the oil pick-up tube so that it is not getting the right amount of oil at idle. I would do a mechanical oil pressure test at idle to make sure that the pressure at idle is at spec which is around 10-12 psi minimum.