TheSearcher
Registered User.
- Local time
- Yesterday, 20:44
- Joined
- Jul 21, 2011
- Messages
- 304
I have a function that queries a table. The table has a record in it. But the recordset returns EOF.
The first msgbox tells me that the query reads correctly.
The second msgbox tells me that there are no records matching the criteria of the query. But there definitely is. If I copy and paste the query in design mode it correctly returns the record.
Any idea what's going on here?
The first msgbox tells me that the query reads correctly.
The second msgbox tells me that there are no records matching the criteria of the query. But there definitely is. If I copy and paste the query in design mode it correctly returns the record.
Any idea what's going on here?
Code:
Public Function CheckLock(ByVal UID As Integer)
Dim sql1 As String
Dim db As Database
Dim rs As Recordset
Set db = CurrentDb
sql1 = "select UID, Full_Name from tbl_Lock where UID = " & UID
MsgBox sql1
Set rs = db.OpenRecordset(sql1)
If rs.EOF Then
MsgBox "EOF"
End If
If rs.EOF Then
CheckLock = "Free"
Else
CheckLock = "Locked"
End If
rs.Close
End Function