Form_load Vs. Form_Open

R

Rick Brandt

Hi,

Is there anyone knows the difference between Form_load and
Form_Open?

Open is before the data is loaded. Load is after. (seems obvious now right?) You
can do some things in Open that you can't do in Load (like cancel the open) and there
are some things where only Load works (like testing values in controls). The help
file explains all of this.
 
L

Larry

When you open a form the sequence of events is
open
load
resize
activate
current
Access gives you a chance to do a procedure at any one of
these steps.
When you close a form the sequence of events is
Unload
Deactivate
Close
 
D

Dirk Goldgar

Hi,

Is there anyone knows the difference between Form_load and
Form_Open?

Thanks!

XR

The help file does. Did you look there first?

---- quoting from help entries ----
Open Event
The Open event occurs when a form is opened, but before the first record
is displayed.

Load Event
The Load event occurs when a form is opened and its records are
displayed.

When you first open a form, the following events occur in this order:

Open ==> Load ==> Resize ==> Activate ==> Current

If you're trying to decide whether to use the Open or Load event for
your macro or event procedure, one significant difference is that the
Open event can be canceled, but the Load event can't. For example, if
you're dynamically building a record source for a form in an event
procedure for the form's Open event, you can cancel opening the form if
there are no records to display.
---- end of quote ----

The form's Open event occurs before the form's recordsource is queried,
making it a good time to set or modify the recordsource. Note that it
is possible to execute code in an event procedure for the form's Open
event that forces the recordsource to be queried and the Load event to
fire before the Open event procedure finishes.
 
G

Guest

Thanks for all your replay. I also found the answer from
Access Help.

[ I was looking for "Form_load" nad "Form_open", I should
search on "Open Event".]

:)
 
T

tina

i can understand how you'd have trouble finding the topic
in Help - Access Help is murder to try to find info on
something you don't already know!
here's a tip you may not know about: in a form or report
design view, you can open the Properties box and click on
a specific property or event line, and then press F1 - it
will usually take you directly to the appropriate topic in
Help. this works in table design view from the Field
Properties section, and in macro design view from the
Action Arguments section, also.

hth
 
V

Van T. Dinh

Open is before the data is loaded

Not quite. If you do a Debug.Print of some Field (or bounded Control?), you
find that there is a value already. Even if you do a RecordCount of the
Form's Recordset, it is > 0.
 

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