When you spot a line of ants marching toward food, or spilling out of a crevice in the wall, identify what they are after and then mark their point of entry. If they're after food, leave it there -- ants are easier to kill if they're in a line. Dip a sponge in soapy water and wipe away the ants. Block the entry point with a smear of petroleum jelly or a square of duct tape, until you can permanently close the hole or crack with silicone caulk.
When ant infestations persist, it may be necessary to attack the ant colony -- both the parent and the satellite ones. Because ants share food, poisoned baits -- usually made of boric acid with a sweet attractant -- are effective. Use a commercial boric acid bait, available at hardware stores, in the spring since they become less effective in hot and dry weather. Place bait near the end of the line, not near the nest; follow label directions. Be careful not to disturb trails between any nest and bait stations -- otherwise you may prevent ants from carrying the bait back to the colony. Keep bait out of the reach of children.