Controls for all Forms

TurboDieselOne

Registered User.
Local time
Today, 20:12
Joined
Jan 16, 2003
Messages
39
Instead of using the code in each form:-

Private Sub cmdClose_Click()
On Error GoTo Err_cmdClose_Click

DoCmd.Close

Exit_cmdClose_Click:
Exit Sub

Err_cmdClose_Click:
MsgBox Err.Description
Resume Exit_cmdClose_Click
End Sub

Private Sub cmdFirst_Click()
On Error GoTo Err_cmdFirst_Click
DoCmd.GoToRecord , , acFirst

Exit_cmdFirst_Click:
Exit Sub
Err_cmdFirst_Click:
Resume Exit_cmdFirst_Click

End Sub

Private Sub cmdLast_Click()
On Error GoTo Err_cmdLast_Click

DoCmd.GoToRecord , , acLast

Exit_cmdLast_Click:
Exit Sub
Err_cmdLast_Click:
Resume Exit_cmdLast_Click
End Sub

Private Sub cmdNext_Click()
On Error GoTo Err_cmdNext_Click
DoCmd.GoToRecord , , acNext

Exit_cmdNext_Click:
Exit Sub
Err_cmdNext_Click:
Resume Exit_cmdNext_Click
End Sub

Private Sub cmdPrevious_Click()
On Error GoTo Err_cmdPrevious_Click
DoCmd.GoToRecord , , acPrevious

Exit_cmdPrevious_Click:
Exit Sub
Err_cmdPrevious_Click:
Resume Exit_cmdPrevious_Click

End Sub

I would like to put this in a module or function so that I have a One step of Code for All Forms:Active that is and possibly an allow edits button as well

This is a great site and well If I owned a bar I think I would call it "Access"
 
G’day TurboDieselOne

This could be cleaned up a little but see how you go.

Regards,
Chris.
 

Attachments

I got it to Work with Access 2000 - 2003 how I don't know but It works. I'll examin the code and see if I can see what is going on under the blankets

Thanks
 

Users who are viewing this thread

Back
Top Bottom