John What I think is to have a public function for each button on the form, which can be called when the button is clicked.
For example, in the onclick event of a button "cmdNextRecord" on any form, you can call the following function by simply entering GoToNextRecord. You can have another function for Previous, First, Last and New which are called when their respective buttons are clicked. Function GotoNextRecord() DoCmd.GoToRecord , , acNext End Function You can of course insert error handling routines as usual. There may be a better approach but this I think is the simplest. HTH Liveson ----- Original Message ----- From: "John" <[EMAIL PROTECTED]> To: <[email protected]> Sent: Thursday, 06 April, 2006 07:11 Subject: [ms_access] Universal Navigation Controls I've created a bunch of forms with their own navigation buttons (people were complaining the standard set was too small.) So I made them a nice 0.25" each etc... I have about 16 forms with these buttons. What I'm wondering is can I create a module to hold this code and have the forms call it up instead of having to write the code for 16 forms. For example: To move to the first record I have: Private Sub cmdbtnFirstRecord_Click() On Error GoTo Err_cmdbtnFirstRecord_Click DoCmd.GoToRecord , , acFirst Exit_cmdbtnFirstRecord_Click: Exit Sub Err_cmdbtnFirstRecord_Click: MsgBox Err.Description Resume Exit_cmdbtnFirstRecord_Click End Sub Is there a way to make this a global function for all forms, like a function? I'm thinking: Function cmdbtnFirstRecord_Click() On Error GoTo Err_cmdbtnFirstRecord_Click DoCmd.GoToRecord , , acFirst Exit_cmdbtnFirstRecord_Click: Exit Function Err_cmdbtnFirstRecord_Click: MsgBox Err.Description Resume Exit_cmdbtnFirstRecord_Click End Function How would I go about calling the function? Or is there a better way? Thanks. Yahoo! Groups Links Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/ms_access/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
