when I turn the ac on check engine lite coms on on 1990 BMW 525i

turned up idle didn't help

Asked by for the 1990 BMW 525i
Possible that your charging system is wearing out. Need to have battery and alternator tested to be sure they are producing enough power. Get code read at a parts store and post the result on here.
lite goes off when you shut off ac so no stored code
1 more answer , 1 more comment
Bring vehicle to shop. Don't be dumb, dummy!!
I't wont be your shop. "ASSHOLE"