sub 'Object'_Open(cancel as interger)

G

Guest

In the open event sub procedure of a form. The help says that the 'Object' is
the name of the form. I have a form with name as Admin and Caption as
Admin_Form. When I click on the properties window, event tab and then click
the build button next to the 'on open', event. The wizard opens, a procedure
with the name 'private sub form_open(cancel as integer)'. If I open another
form with a different name and start its open sub. It again opens with the
same 'private sub form_open(cancel as integer)'. How does Access distinguish
between these 2 form open event subs. Why does it not take the name that is
assigned to it.

I am using Access 2003 and Widows XP.
 
M

Michel Walsh

The code belong to the 'blue print" of the class, all objects created from a
given class share in common the code, and only the private members
(variables or other embedded objects) are created on a per object basis. The
blue print holds all the procedure that are defined within it. So, two Open
procedure can exists, but each one inside a different blueprint, like two
Main street can exist, as long as they are in different city, there is no
possible confusion.

When an object is created from FORM_A, the blue print for that class is
used, and memory is reserved for all the private variables, including an
internal 'pointer' telling where the 'executable code is' . So, when the
object need access to the code of the class, it knows where to look. The
code itself knows on which set of private data it should operate through the
ME pointer.

When an object is created form FROM_B, the blue print for THAT class is
used, and, internally, through a pointer, knows what code is to be run, and
does not run the method Open of FORM_A, but of FORM_B.



Hoping it may help,
Vanderghast, Access MVP
 

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