If you just want to see the record set then you could do something like the following:
Dim qdef As Dao.QueryDef
Set qdef = CurrentDb.CreateQueryDef("MyQuery", "SELECT * " & _
"FROM TableName " & _
"ORDER BY columnA, columnB")
DoCmd.OpenQuery "MyQuery"
Then once you are done doing whatever it is you want to do with it you could execute the following to remove the query:
On Error Resume Next
DoCmd.DeleteObject acQuery, "MyQuery"
Or you could do the following:
Dim RSData as DAO.Recordset
Set RSData = CurrentDB.OpenRecordSet("SELECT * " & _
"FROM TableName " & _
"ORDER BY columnA, columnB")
If (RSData.RecordCount > 0) Then
RSData.MoveFirst
Do While RSData.EOF <> True
'HERE YOU CAN WORK WITH EACH FIELD OF THE RECORD INDIVIDUALLY USING
RSData.Fields("columnA").value
RSData.MoveNext
Loop
End If
Then once you are done doing whatever it is you want to do with it you could execute the following:
RSData.Close
Set RSData = Nothing