Calling modules

  • Thread starter Thread starter Peter Hamilton
  • Start date Start date
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.
 
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
 
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
 
Back
Top