Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Should I use Form_Load or Form_Open? 1

Status
Not open for further replies.

Sadukar

Technical User
Feb 19, 2003
159
IE
Hi,

Sorry if this is a bit of a stupid question but I have no access to a help file.

What is the difference between
Private Sub Form_Load() and Private Sub Form_Open(...)

I want to run a few comands when a form is opened. Should I put them in Form_load or Form_Open?

Thanks
S.
 
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.

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

Unload, Deactivate, Close

The Unload event occurs before the Close event. The Unload event can be canceled, but the Close event can't.

Hope this helps.

[pc2]
 
Thanks MP

Exactly what I needed to know.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top