It depends on the type of ants that you have. I always have ants in the hives. Most of them are the garbage collectors (sugar ants) that clean up what the bees drop.
I have had what I think was bull ants or a cousin to the carpenter ant that moved in one evening and killer the hive. I killed every one of them and never had that problem again. Knock on wood.
The cheapest long term way to protect your hives is to put used coffee grounds around the bases of your hives. Cinnamon also works but washes away every time it rains. Limestone power also works.