gas cap loose is turning on service engine light soon on on 2005 Buick LeSabre

Will a new gas cap turn off service engine light soon off if a new gas cap is the solution?

Asked by for the 2005 Buick LeSabre
2 answers
have codes scanned at auto zone and post so we can adv
A new cap will not turn the light off IF indeed it was actually the problem. But a scanner will and while hooked up scan codes as suggested.