Display Query Results in MsgBox

  • Thread starter Thread starter M
  • Start date Start date
M

M

I have a query that returns the oldest record in a table.
How do I have this one record displayed in a MsgBox?

Thanks

M
 
You'll need to do it in code:
Dim db As Database
Dim rs As DAO.Recordset

Set db = CurrentDb
Set rs = db.OpenRecordset(qryMyQuery)

If rs.AbsolutePosition > -1 Then
MsgBox rs!somefield
Else
MsgBox "No records found."
End If

rs.Close
Set rs = Nothing
Set db = Nothing

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
 
That works great. Thanks for your help!

M


-----Original Message-----
You'll need to do it in code:
Dim db As Database
Dim rs As DAO.Recordset

Set db = CurrentDb
Set rs = db.OpenRecordset(qryMyQuery)

If rs.AbsolutePosition > -1 Then
MsgBox rs!somefield
Else
MsgBox "No records found."
End If

rs.Close
Set rs = Nothing
Set db = Nothing

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia




.
 
Back
Top