MS-ACCESS: displaying query results in a message box

how can i pass the query result to msgbox in access?

+3
source share
2 answers

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.

+3
source

I'm not sure I understand, but to set the text displayed in the message box, you can call:

MsgBox strYourTextHere

Here is the documentation for the MsgBox function for Access 2007.

0
source

Source: https://habr.com/ru/post/1726383/


All Articles