I learnt about how to fix Kies connection errors

I had a problem that my Samsung Galaxy S3 would not connect to Kies. It had previously connected. After much searching I came across the following solution:

Unplug the USB cable from your phone.
On the phone, dial the following number: *#7284#
Once the last # is hit, the PhoneUtil application should be launched.

Choose USB -> Modem and then USB -> PDA mode.

The good mode should be PDA. Even if the mode is PDA, switch to Modem and then back to PDA!!!

Now Plug the USB cable back in your phone/PC and check if it works.

(From here)  and it worked for me.