Calling modules

P

Peter Hamilton

Could some one give me a quick refresher course on how to
call a module(s) from a command button's OnClick event
procedure.
 
T

Tim Ferguson

Could some one give me a quick refresher course on how to
call a module(s) from a command button's OnClick event
procedure.

Just as you cannot put data into a database because the data go into the
tables, you can't call a Module from anything: it's only the container for
all the Subs and Functions inside it, which you can call.

Calling a sub is easy: you just, erm, call it

Public Sub MyButton_Click()

' this is a plain call
MakeFormFlash

' this is a call with a parameter
MakeFormColoured("Red")

' and this is a call to a function, which has to
' return an answer
Me.Caption = GenerateNewFormCaption("Red Rum Form")

End Sub


Hope that helps

TimF
 
S

Shirley

If the function/sub is only needed in the same form where
your control is, then you can just put it inside this
form. If you want to call this function/sub from any form
in your application, you can put it in modules --
click "Modules" under Objects, and then click "New".

Shirley
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top