Air conditioner problem on 2001 Accent

When I turn on the air conditioner on my automatic 2001 Accent, the transmission will shift really rough on low speeds. It sounds like I am stuck on a low gear when accelerating and I hear a thunk sound when
slowing down. The check engine light is on solid but it will go off if I drive without AC.
What is going on?
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
The first step in diagnosis is probably to retrieve the engine and transmission codes.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

Motorsforum.com is a website by car enthusiasts for car enthusiasts. It is not affiliated with any of the car or spare part manufacturers or car dealers discussed here. All logos and trade names are the property of their respective owners.