I’m having an issue with the following lines of code, I feel its something simple but I can’t put my finger on it. I get a Run-time error ’91’ object variable or with block variable not set error. The error happens on the rsc.OpenRecordSet... line. BadgeV is a number, I have the DAO reference installed, It is pulling from a linked sql server table where I have a primary key and identity. What am I missing?
Function FNC_Scan()
Dim db As DAO.Database
Dim rsc As DAO.Recordset
Set db = CurrentDb()
rsc.OpenRecordset ("SELECT dbo_ScanData.CardID, dbo_ScanData.Complete FROM dbo_ScanData WHERE (((dbo_ScanData.CardID)= Forms![Scan]!BadgeV))) AND ((dbo_ScanData.Complete)=0));")
If rsc.EOF Then
MsgBox "new item"
Else
MsgBox "Append Item"
End If
Set rsc = Nothing
Set db = Nothing
End Function
Should be
instead of