You might want to use a recordset.
Dim rs As DAO.Recordset
Set rs=CurrentDB.OpenRecordset("NameOfQuery_Table_Or_SQLString")
If Not rs.EOF Then
MsgBox "Hi, the first record, first field is " & rs.Fields(0)
End if
You can also use the ADO recordset if you want to return all records to a string.
It may be easier to use DLookUp, it all depends on what you want to return and where.
source
share