New coder NEEDS HELP!

ian_ok

Registered User.
Local time
Today, 18:34
Joined
May 1, 2001
Messages
90
I have some code that is repeated in variouys forms etc.

From what I believe you can make the code a module and direct the event to it, instead of writing the code for each form that the same code is required.

How would I go about doing this, say for the code below.

Private Sub Form_Close()
DoCmd.Close acForm, "Householder Menu"
DoCmd.OpenForm "Householder Menu"
End Sub

Thanking you in advance.

Ian
 
Set up your code in the global modules and give it a descriptive name eg House_Form_Status. From whichever form module, refer to the code eg,

Global Module:
Sub House_Form_Status()
Your Code...
End Sub

Form Module:
Private Sub Form_Close()
House_Form_Status
EndSub

It should then run the code in the global module (I think)
 

Users who are viewing this thread

Back
Top Bottom