Someone from another forum gave me the code I was looking for (Below). Thanks for your help!
dim rs as dao.recordset
dim strSQL as string
dim holdA, holdB, HoldX
strSQL = "SELECT A, X, B FROM YourTable ORDER BY A, B"
set rs = CurrentDB.OpenRecordset( strSQL, dbOpenDynaset)
holdA = ""
holdB =...