Modules??

superrob5

Registered User.
Local time
Today, 03:31
Joined
May 8, 2003
Messages
99
can someone explain to me how to use modules. Is it used if you are going to repeat code often??? how do I call on them in an onclick .

Rob
 
Modules usually include functions or subroutines which are called from multiple objects (forms, reports, queries, etc.). Be sure to make them "Public".

A function can be called by setting the OnClick property to "=YourModuleFunctionName(YouArgument1, YourArgument2, etc.)" without the quotes. Alternatively, you can use VBA code in a form as follows:

Public Function YourButton_OnClick(Arg1,Arg2) as Integer
YourButton_OnClick = YourModuleFunctionName(Arg1,Arg2)
End Function

On Event YourButton_OnClick event, generate a subroutine which call a subroutine contained in a module, e.g.

Public Sub YourButton_OnClick
YourModuleSubroutineName(Arg1,Arg2)
End Sub

Hope this gets you started.
 

Users who are viewing this thread

Back
Top Bottom