Creating the same command buttons on multiple forms

vangogh228

Registered User.
Local time
Today, 08:11
Joined
Apr 19, 2002
Messages
302
I have created a form with several command buttons that facilitate navigation between the forms. I would like to include these same buttons in the same place on all my forms... sort of like the way a frame or shared borders work in Frontpage... as a menu. I am able to maximize all my forms so that if I place them down the left they always show in the same place, but....

when I copied and pasted the command buttons and labels from the first form to others, I lost all the functionality of the buttons. I also tried to SAVE AS the form name, but the same thing happened.

Is there an easy way to include the same commands and buttons with labels on multiple forms without having to go through the command button wizard every time?

Thanks!!
 
One way would be to save the form with just the buttons and code only then make a copy. Add the other fields, etc. to your 'template'.
 
Put your code in a module, make your functions public.Example:
Public Function CloseOpen(strName As String)
DoCmd.Close
DoCmd.OpenForm (strName)
End Function

Then when you add a button refer to the Public function in the on click event ie.
=CloseOpen("frmPartsData")
All you have to do is pass the form name to the function.
HTH
 

Users who are viewing this thread

Back
Top Bottom