“To err is human: To forgive, canine.”
The first thing you need to do when trying to control your dog's barking is to determine where your dog's threshold for barking is. This threshold determines the minimum distance from which your dog can be away from an object before a barking response occurs.
It does no good to put your dog in an environment or situation where you know he/she will bark, and then attempt to train the dog not to bark!
Here's an example of how this works:
So what do you do? Desensitize the dog by rewarding the quiet behavior just below your dog's barking threshold. Slowly decrease your dog's threshold while increasing the rewards (treats!) as the exercise becomes increasingly difficult.
If your dog starts to bark again, first distract your dog from what he/she's barking at. Try to avoid pulling your dog away from the object, but rather lure him/her away. You can do this by clapping, squeaking a toy, using a high-pitched voice, or a food treat- basically anything that will get your dog's attention on you. If you use a food treat, make sure you do not put it in his/her mouth while he's looking at the 'bark object'. This inadvertently rewards the barking behavior!
Desensitize the dog by rewarding the quiet behavior just below your dog's barking threshold.
When he/she has stopped barking for 2 seconds , and has his/her focus on you, reward your dog with lots of praise and treats. Start again later, slowly decreasing the distance between your dog and the object. Make it easy for your dog to succeed! Make sure that your dog does not bark more than once out of every 10 times during this exercise. If he receives some sort of reprimand/correction for barking more than once, there is a possibility that the dog may develop a negative association to whatever he/she is barking at. Again, work slowly and at your dog's pace.