I might add that in all those years I had ants in the hive, I never once noticed them to be more than an irritation to the beekeeper, they didn't seem to affect the bees as much as mites, Small Hive Beetles, or Wax Moths. In other words I consider the concern over ants way over blow and opted to ignore their existance years ago.
It depends on where you are. If you have Argentine ants (the little black ones) they are a bigger killer of hives out here then mites and wax moths combined. They are probably the number one killer of beehives.
The oil trick can work, and grease etc.. but when wind blows leaves around the ants will still get in.
One thing that SOMETIMES works is mixing one third Borax with honey and putting a couple tablespoons in a container. Any sort will do, like a plastic water bottle. Prick little holes on one side and put it under or around the hive with the holes on the ground. The ants will harvest from the mixture and you will usually be able to knock down a small to medium problem with this method. With bigger problems it won't work, though.