Question : Display Query Results in a Message Box

In access I have a query named 'qryData' that returns one record of results.  I need a block of VBA code that will display in the Message Box the value for specific fields in the query.  It would probably look something like this...

MsgBox "The total for " & [qryData].[fldOne] & " for the " & [qryData].[fldThree] & "is " & [qryData].[fldTotal]

Any ideas are greatly appreciated.  Thanks!

Answer : Display Query Results in a Message Box

Small errors. Change rst to rs:
Dim dbs As Database
Dim rs As Recordset
Set dbs = CurrentDb
Set rs = dbs.OpenRecordset("qryData")
MsgBox "The total for " & rs!fldOne & " for the " & rs!fldThree & "is " & rs!fldTotal
rs.Close
dbs.Close
Set rs = Nothing
Set dbs = Nothing
Random Solutions  
 
programming4us programming4us