Order a recordset by looping through it?
Posted on 2004-10-12
I'm hoping someone can help me modify this code. The code below loops through a Microsoft MapPoint recordset, and assigns a sequentially numbered Pushpin symbol to each record in the recordset. This code works perfectly fine, except that the recordset is not in the proper order that I need, and there doesn't seem to be a method available to sort the recordset object. I need my recordset to be ordered according to this field: objRS.Fields(24).Value
Is there a way that I can loop through the recordset to find the lowest value for "objRS2.Fields(24).Value", then assign the numbered pushpin symbol, then loop through the recordset again to find the next lowest value in that same field and then assign the next numbered pushpin symbol. I guess the structure that makes the most sense to me would be some sort of nested loop, but I can't seem to figure out how to structure it. Thanks so much.
Dim objRS As MapPoint.Recordset
Dim objDataSet As MapPoint.DataSet
Set objRS = objDataSet.QueryAllRecords
Set objDataSet = objApp.ActiveMap.DataSets.Item(2)
intSymbol = 208
Do Until objRS.EOF
objRS.Pushpin.Symbol = intSymbol
intSymbol = intSymbol + 1