before doing any processing on your recordset, why not use the '.sort' method first to get the data into the order you want.