Question Locked

MS Access 2003 Forms on open event VBA

0 helpful
4 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

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.

4 replies

by onbliss

If you notice, both forms are treated as "Microsoft Office Access Class Objects". Consider them as objects derived from the class (a.k.a Type) Form. "Open" is just one of the events of the Form. Objects contain data, properties, methods that can be different from other similar objects.

Hence when Access opens one of the forms, it knows the object and its data;properties and events.

by sxviswan

But whe you read through the code how should one understand for which form is the open event group of statements is for?

by tony hopkinson

Think of it as MyForm.Open(Cancel as integer)
and MyOtherForm.Open(Cancel as integer)

VBA simply allows you to skip putting in the class name of the form.

This discussion is closed to new replies.