santanudas
Technical User
Hi all,
I've a simple code to show the result based on a SQL quary:
Private Sub cmdRun_Click()
Dim dbs As DAO.Database
Dim SQLStmt As String, trs As DAO.Recordset
Set dbs = OpenDatabase("E:\My Documents\CSSC_booking\booking.mdb"
SQLStmt = "SELECT [status] FROM [tblBooking] WHERE [tblBooking].[room] = " & cmbRoom.Value & ";"
'MsgBox SQLStmt
Set trs = CurrentDb.OpenRecordset(SQLStmt)
' , dbOpenDynaset)
If Not (trs.EOF And trs.BOF) Then
trs.MoveLast
trs.MoveFirst
Do While Not trs.EOF
MsgBox trs.Fields(8)
trs.MoveNext
Loop
End If
End Sub
Here the fiels 'room' is numeric. It's giving a run-time error: Run-time error '3265'
Item not found in this collection
Can any one help me please.
Thanks in advance.
Santanu