I tried the potato slice thing one time and the gnats seemed entirely uninterested. The gnats can't really do any harm to an established plant, it would have to be one hell of an infestation. They mainly eat fungus (hence why they're called fungus gnats) and dead organic matter. Obviously, though, they are really annoying and during late flowering they have a tendency to become stuck in the lowers buds.
Sticky traps are good and really everybody should have them in the grow room whether they have any kind of flies or not. There are the long strips that hang from the ceiling/elsewhere, available at most home improvement centers, and there are also those that go on stakes placed right into the soil which is what kend is referring to, I believe. Those kind are not as widely available; I like the Safer brand as opposed to the Gnat-Stix because the Safer ones have plastic stakes, are multi-tiered and are just plain nicer to work with. The Gnat-Stix have wooden stakes and those have a tendency to decay in organic soil.
If possible, you should use the fly strips that hang from the ceiling in conjunction with those that you stick right into the planting media.
Sand might help on the top layer, but the gnats will find other points of entry such as the drainage holes. Some people recommend putting Diatomaceous Earth on top of the soil, and I would imagine that they've never actually done it themselves because it turns into a sloppy fucking mess. DE also has to be dry in order to work; it kills by mechanical and not chemical means, basically dehydrating and piercing the body of the insect. If anything you could spread DE on the floor and in crevices where the gnats fly around, if they get any on themselves they will died within 48 hours.
I have had some success using a Pyrethrin spray and Mosquito Dunks (Bacillus thuringiensis isreali). Pyrethrin as a botanically-derived insecticide that kills on contact and breaks down within several hours, it is no toxic to birds, mammals or amphibians and leaves no toxic residues which is ideal for our purposes. The spray is widely available, again at most home improvement centers. I am pretty sure this is the same stuff as Dr. Doom, only that brand costs more than it should.
The Bti is a natural bacterium that kills the larvae of a few select species of insects, including fungus gnat larvae (and mosquito larvae). The Mosquito Dunks are widely available; you can soak a dunk in a bucket or jug over night and apply the water to the soil. Do this periodically.