The best way to prevent fly problems in a home is to exclude them by screening

Flying insects, especially flies, carry disease – producing organisms known as pathogens. Flies especially are filthy creatures. They tend to feed on excrement, decaying food, dead bodies and other disgusting substances. Whenever they land or feed on these potentially disease-ridden areas, pathogens are transferred onto their numerous body hairs or are ingested into the gut.

Flies cannoteat solid food, so to soften it up they regurgitate digestive juices and their stomach contents onto the food substance. They then stamp the vomit in to form a liquid, usually stamping in a few germs for good measure. This “liquid” is then drawn up by the suctorial mouthparts and in so doing the insects pick up pathogenic organisms, which may collect on their bodies to be transferred on contact with other surfaces or survive passage through the gut to be deposited as fly spots