Alek,
If you want code to be available from anywhere in the application, it has to
be in a standard module, but it must be declared Public:
Public Sub myProcedure()
To make the code available only from within the module in which is is
declared, declare it as Private.
If you want code to be available from anywhere in the application, but only
when a form is open, you can put it in the form's class module. Even then,
it must be declared Public. To get at that code, you'll need to include the
form in the call:
Forms!frmMyForm.myProcedure
....or...
Form_frmMyForm.myProcedure
To make a form's/report's code available only within the form/report,
declare it as Private.
If you want the code to be available only from within the module or class
that instantiated (created) it, place it in a class. But the procedure (now
called a Method) must be declared Public. Assuming you have a class called
myClass, and a procedure (method) within that class called myMethod, you
would call it like so:
Dim cls As myClass
Set cls = New myClass
cls.myMethod
' - - - -
' - - - -
Set cls = Nothing
Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia