Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MS-ACCESS: displaying the results of a query in a message box

Tags:

ms-access

how do i feed the result of a query into a msgbox in access?

like image 862
Alex Gordon Avatar asked Dec 09 '25 22:12

Alex Gordon


1 Answers

You may wish 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 could also use an ADO recordset if you wish to return all the records to a string.

It might be easier to use DLookUp, it all depends on what you want returned and from where.

like image 86
Fionnuala Avatar answered Dec 14 '25 01:12

Fionnuala



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!