Sub ProcessQuery(QueryName As String)
Dim db As Database, qdf As QueryDef
Dim rst As Recordset
Set db = CurrentDb
Set qdf = db.QueryDefs(QueryName)
Set rst = db.OpenRecordset(qdf.SQL)
' Loop through the recordset
Do While Not rst.EOF
' Use the data in the record here
rst.MoveNext
Loop
rst.Close
db.Close
' Set DAO vars to Nothing to avoid memory leak
Set rst = Nothing
Set db = Nothing
End Sub