What is difference between Form_Load and Form_Open?

  • Thread starter Thread starter Edward P Sager
  • Start date Start date
E

Edward P Sager

Hello,

What is difference between Form_Load and Form_Open?

Which occurs first?

Does it really matter if one uses Form_Open or Form_Load when using modules
and assigning values to variables?

Thanks,
edsager
 
Edward said:
Hello,

What is difference between Form_Load and Form_Open?

Which occurs first?

Does it really matter if one uses Form_Open or Form_Load when using
modules and assigning values to variables?

Form load happens before open
They do exactly as the words imply.

If you need to modify a form before opening it then load is the better
choice.
 
Excuse me, but it's just the reverse. This is from Help file:

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.

I would add to the above that the Load event should be used if you want to
set the value of controls that are on the form. Often, controls are not
available during the Open event because the form doesn't always "establish"
them until the Load event is ready to occur.
 
Hello,

What is difference between Form_Load and Form_Open?
Several.

Which occurs first?
Form_Load.

Does it really matter if one uses Form_Open or Form_Load when using modules
and assigning values to variables?

Yes: basically, the Load event fires before the controls in the form
have been filled with data (or, for that matter, before the controls
even exist); the Open event occurs after the controls have been
created and filled. The Load event is appropriate if you want to do
something with the form itself (such as maximizing it); the Open event
lets you check or set values of controls on the form.
 
John Vinson said:
Yes: basically, the Load event fires before the controls in the form
have been filled with data (or, for that matter, before the controls
even exist); the Open event occurs after the controls have been
created and filled. The Load event is appropriate if you want to do
something with the form itself (such as maximizing it); the Open event
lets you check or set values of controls on the form.

Huh? John, are you sure you haven't got these backward?
 
Back
Top