There is no anti insect vaccine.
Some natural fly deterrents include : citronella and rosemary oil.
Remember, any repellant will need to be re-applied at regular intervals. I find that it lasts about as long as sunscreen depending on activity. So, you might need to reapply every 4 hours or so to keep the flies off.
Of course cleanliness is key! Any trash, left over food, dog feces in the yard, compost, neighbors trash etc will draw more flies. So, you will need to remove that problem as well if you have a chance of keeping the flies away from your dog.
Some flea and tick preventatives like Advantage also help prevent flying bugs so try them as well. Frontline might also help prevent biting
insects like fleas and ticks, but also discourage biting flies as well as a second option.
Adam's flea and tick spray is pretty good for repelling bugs in my experience, but again, it has to be applied a few times a day. Be careful to not spray in eyes