Hi H,
you're welcome
a procedure is either a Sub or a Function
Its visibility is either Public or Private. If a procedure in code
behind a form and is defined to be Private, then only that form can see it.
here is some text from Access Basics, p 5-17:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To see the code behind a form (anything said about code behind a form
also applies to code behind a report): from the menu in the design view
of a form, choose --> View, Code
This will take you to the module sheet that is stored 'behind' and with
the form. When the form is copied, the module sheet tags along without
you having to do anything special. This kind of code is a Class Module
as opposed to a Standard (General) Module. When you Click on the Modules
tab in the Database Window, you see a list of Standard Modules -- they
are able to be used by any form, any report, any query ... anything in
the database. Therefore, their scope is global.
A Procedure is a general term encompassing Subs and Functions. If you
look at a procedure declaration you might see something like this:
Private Sub eAddress_DblClick(Cancel As Integer)
Private means that only this form (and module stored behind the form)
can see and use this code -- its scope is limited to the form.
Sub means it is a Subroutine that does not return a value as opposed to
a Function which does ... or maybe I should say 'can' -- return a value.
A Function can do everything a Sub can -- a weird thing -- you cannot
assign a Sub directly to a property event, it must be a Function by
definition -- and there is no way to use a return value in these cases.
Why Microsoft chose to use Functions instead of Subs in Access is a
mystery. With this in mind, it seems odd that the [Event Procedure] code
is a Sub --not consistent! ... anyway, I digress...
eAddress_DblClick means that there is a control with the Name 'eAddress'
and this is the DoubleClick event procedure -- so it will be launched
(triggered) when the user double-clicks on the control.
Cancel As Integer -- Cancel is a parameter to the sub -- although most
people don't think of "Cancelling" a DoubleClick event because you can
simply exit it! Cancel is better understood on an event such as
BeforeUpdate where you Cancel the Update to a control or prevent Access
from saving a record if certain conditions are not met. 'As Integer'
means that Cancel is a whole number < 32K. Some event procedures have
Cancel as a parameter but most do not. For instance, out of the 50
events that can be defined at the form level, 13 of them have Cancel as
a parameter.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
anyway, thank you for your comments! I appreciate you mentioning
something you thought I needed to know ... actually, I did so I could
explain better <smile>
Warm Regards,
Crystal
remote programming and training
Access Basics
8-part free tutorial that covers essentials in Access
http://www.AccessMVP.com/strive4peace
*

have an awesome day

*