NEW YORK ( TheStreet) -- AnnTaylor Stores ( ANN) swung to a second-quarter loss as sales fell from a year ago, although the company topped expectations on an adjusted basis and offered a rosy view for the third quarter. The apparel retailer swung to a second-quarter net loss of $18 million, or 32 cents a share, compared with a net profit of $29.3 million, or 50 cents a share, in the year-ago quarter. Excluding restructuring charges, AnnTaylor said it would have earned 6 cents a share in the quarter, down from a profit of 53 cents a year earlier. Revenue fell 20.6% to $470.2 million from $592.3 million in the same quarter a year ago. Comparable store sales for the quarter declined 22.5% from the prior year, AnnTaylor said. Gross margin was 52.4%, unchanged from a year ago. LOFT was the best selling division during the second quarter. Net sales were $250.5 million in the second quarter, compared with net sales of $299.1 million in the year-ago period. By comparison, net sales at the company's flagship stores were $108.9 million in the second quarter of 2009, compared with net sales of $185.7 million in the second quarter of 2008. On average, analysts were looking for a profit of 3 cents a share on revenue of $472.2 million, according to Thomson Reuters. Looking ahead, AnnTaylor said it expects a slight sequential improvement in both total sales and gross margin rate performance from the levels achieved in the second quarter. On average, analysts expect revenue to fall to $462.1 million in the third quarter.