Can anyone tell me why i get an error with this.
All im trying to do is get the top number from a table to a variable to use in an automated e-mail. But i get type mismatch with the msgbox line highlighted.
'===============================
Function TopNum()
Dim Ndb As Database
Dim PNum As Recordset
Dim Nsql As String
PNumsql = "SELECT TOP 1 qryTopNum.NumberField FROM qryMyQuery;"
Set Ndb = CurrentDb()
Set PNum = Ndb.OpenRecordset(Nsql)
MsgBox PNum
End Function
"My God! It's full of stars...
All im trying to do is get the top number from a table to a variable to use in an automated e-mail. But i get type mismatch with the msgbox line highlighted.
'===============================
Function TopNum()
Dim Ndb As Database
Dim PNum As Recordset
Dim Nsql As String
PNumsql = "SELECT TOP 1 qryTopNum.NumberField FROM qryMyQuery;"
Set Ndb = CurrentDb()
Set PNum = Ndb.OpenRecordset(Nsql)
MsgBox PNum
End Function
"My God! It's full of stars...