When glassware comes out of the dishwasher with a unsightly, cloudy film, hard water is most likely the culprit. Calcium and magnesium carbonate ions in hard water form a buildup of lime, which hardens with age. This means that the longer your glasses have remained cloudy, the harder it will be to eradicate the film that's been etched onto them.
Martha advises that you remove the buildup on your glasses by swabbing them first with acetone, which is nail-polish remover, and then soft scrub. Be prepared to use a good deal of elbow grease. You might also try Swirl-A-Way, which contains an organic form of sand called silicate, which wears down the film. To keep your glasses from developing a hazy film in the first place, don't wash them in the dishwasher. Wash them by hand with a mild soap, rinse thoroughly, and dry immediately.
One solution you might consider is having a water-softening system installed in your home. This solution is fairly costly, ranging from $1,000 to $1,600, but it is permanent.