Hi Rob
Does your code compile OK? (from the VBA window, click Debug>Compile)
I suspect that the problem is actually somewhere else in your code.
--
Good Luck
Graham Mandeno [Access MVP]
Auckland, New Zealand
Hi Robert
[snip]
Yes, that is exactly what I want and it is working perfectly except
for a new problem. I usually add my own buttons using the wizard for
navigation. Now I getting the following error msg:
The expression On Click you entered as the event property setting
produced the following
error: A problem occurred while Microsoft Office Access was
communicating with the OLE
server or ActiveX Control.
This error message occurs when I click on any of the buttons: Next,
Previous, Close ect. Any idea why is is happening?
My crystal ball is a bit cloudy ;-) It's very hard for me (or anyone) to
guess if you don't post the code that is raising the error.
--
Graham Mandeno [Access MVP]
Auckland, New Zealand
Understood the follows:
Private Sub btnFirst_Click()
On Error GoTo Err_btnFirst_Click
DoCmd.GoToRecord , , acFirst
Exit_btnFirst_Click:
Exit Sub
Err_btnFirst_Click:
MsgBox Err.Description
Resume Exit_btnFirst_Click
End Sub
Private Sub btnLast_Click()
On Error GoTo Err_btnLast_Click
DoCmd.GoToRecord , , acLast
Exit_btnLast_Click:
Exit Sub
Err_btnLast_Click:
MsgBox Err.Description
Resume Exit_btnLast_Click
End Sub
Private Sub btnNext_Click()
On Error GoTo Err_btnNext_Click
DoCmd.GoToRecord , , acNext
Exit_btnNext_Click:
Exit Sub
Err_btnNext_Click:
MsgBox Err.Description
Resume Exit_btnNext_Click
End Sub
Private Sub btnPrevious_Click()
On Error GoTo Err_btnPrevious_Click
DoCmd.GoToRecord , , acPrevious
Exit_btnPrevious_Click:
Exit Sub
Err_btnPrevious_Click:
MsgBox Err.Description
Resume Exit_btnPrevious_Click
End Sub
Private Sub btnClose_Click()
On Error GoTo Err_btnClose_Click
DoCmd.Close
Exit_btnClose_Click:
Exit Sub
Err_btnClose_Click:
MsgBox Err.Description
Resume Exit_btnClose_Click
End Sub
This is wizard generated code.