G
Guest
Hi,
Can anyone explain to me why I would get an error at run time with the
following code:
Private Sub FindRecord_BeforeUpdate(Cancel As Integer)
Dim rs As Object
Set rs = Me.RecordsetClone
rs.FindFirst "[Tag Number] = '" & Me![FindREcord] & "'"
If Not rs.NoMatch Then Me.Bookmark = rs.Bookmark
ElseIf rs.NoMatch Then
MsgBox "Must be a valid tag number"
Cancel = True
End If
End Sub
The error showing up with the debugger is "and else statement without an if".
I don't know a lot about visual basic but it seems a standard bit of syntax
to me and I basically copied it from the visual basic help example so can't
understand why it doesn't work. Have also tried it without the if and just
gone straight to msgbox but I get a similar error message.
Thanks in advance.
Mabeline
Can anyone explain to me why I would get an error at run time with the
following code:
Private Sub FindRecord_BeforeUpdate(Cancel As Integer)
Dim rs As Object
Set rs = Me.RecordsetClone
rs.FindFirst "[Tag Number] = '" & Me![FindREcord] & "'"
If Not rs.NoMatch Then Me.Bookmark = rs.Bookmark
ElseIf rs.NoMatch Then
MsgBox "Must be a valid tag number"
Cancel = True
End If
End Sub
The error showing up with the debugger is "and else statement without an if".
I don't know a lot about visual basic but it seems a standard bit of syntax
to me and I basically copied it from the visual basic help example so can't
understand why it doesn't work. Have also tried it without the if and just
gone straight to msgbox but I get a similar error message.
Thanks in advance.
Mabeline