G
Guest
I'm having trouble with the following code, I keep getting "Type mismatch"
error at the "Set rstbd = ..." line:
Dim dbU As Database
Dim rstdb As Recordset
Set dbU = CurrentDb
Set rstdb = dbU.OpenRecordset("SELECT * FROM tblPatients;")
With rstdb
.MoveLast
.MoveFirst
If Not .EOF Then
DoCmd.GoToRecord , , acNext
End If
End With
The code is on the click event of a navigation button. I'm trying to trap
EOF to stop the user clicking into a new record on a form that displays all
records in the db.
Can anybody shed any light on where I'm going wrong, thanks
Ian
error at the "Set rstbd = ..." line:
Dim dbU As Database
Dim rstdb As Recordset
Set dbU = CurrentDb
Set rstdb = dbU.OpenRecordset("SELECT * FROM tblPatients;")
With rstdb
.MoveLast
.MoveFirst
If Not .EOF Then
DoCmd.GoToRecord , , acNext
End If
End With
The code is on the click event of a navigation button. I'm trying to trap
EOF to stop the user clicking into a new record on a form that displays all
records in the db.
Can anybody shed any light on where I'm going wrong, thanks
Ian