Hi, I'm using code to go to the next record and warn that i'm on the last record so it doesn't proceed to a new record.
The code I'm using works if I put it in the 'OnClick' event but if I try to use the same code in a module it fails.
The code is.
Private Sub Next_Click()
With Recordset
If .AbsolutePosition = .RecordCount - 1 Then
'you are on the last record
MsgBox "Sorry, this is the last Record.", vbInformation
Else
'you are on some other record
DoCmd.GoToRecord , , acNext
End If
End With
End Sub
I am using a 'OnClick' event to call it of
Private Sub Next_Click()
navigate.GotoNext() 'navigate (module name) . gotonext (sub name)
It causes a run-time error 424 object required. On Debug the error is highlighted in the line 'If .AbsolutePosition = .RecordCount - 1 Then'
Why does it work as an event proceedure and not from a module and how do I fix it?
The code I'm using works if I put it in the 'OnClick' event but if I try to use the same code in a module it fails.
The code is.
Private Sub Next_Click()
With Recordset
If .AbsolutePosition = .RecordCount - 1 Then
'you are on the last record
MsgBox "Sorry, this is the last Record.", vbInformation
Else
'you are on some other record
DoCmd.GoToRecord , , acNext
End If
End With
End Sub
I am using a 'OnClick' event to call it of
Private Sub Next_Click()
navigate.GotoNext() 'navigate (module name) . gotonext (sub name)
It causes a run-time error 424 object required. On Debug the error is highlighted in the line 'If .AbsolutePosition = .RecordCount - 1 Then'
Why does it work as an event proceedure and not from a module and how do I fix it?