469,280 Members | 1,950 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,280 developers. It's quick & easy.

Difference between Form_Open and Form_Load?

Is there a difference between the Form_Open and Form_Load events? When
should I use one rather than the other? I have several forms that require
code to run when they open... or is it when they load?

Thanks in advance.
Nov 12 '05 #1
6 24820
Hi Deko,

Here's a partial quote from Access97 Help:
----------------------------------------------
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
----------------------------------------------
HTH,
Don

"deko" <de**@hotmail.com> wrote in message
news:0Q***********@newssvr27.news.prodigy.com...
Is there a difference between the Form_Open and Form_Load events? When
should I use one rather than the other? I have several forms that require
code to run when they open... or is it when they load?

Thanks in advance.

Nov 12 '05 #2
deko wrote:
Is there a difference between the Form_Open and Form_Load events?
When should I use one rather than the other? I have several forms
that require code to run when they open... or is it when they load?

Thanks in advance.


Have you tried reading the Help ? :P
--
regards,

Bradley
Nov 12 '05 #3
Another significant difference is that the Form_Load event occurs after the
data has been loaded into the form.
So if you want to do anything with the data, you need to wait until then.

HTH
- Turtle

"deko" <de**@hotmail.com> wrote in message
news:0Q***********@newssvr27.news.prodigy.com...
Is there a difference between the Form_Open and Form_Load events? When
should I use one rather than the other? I have several forms that require
code to run when they open... or is it when they load?

Thanks in advance.

Nov 12 '05 #4
Turtle,

So is there a significant difference between the Load event and the Activate
event. What determines which of these to use?

Say the form moves from record 3 to record 4 and the Current event occurs. If
the current event contains code to make one or more changes to data, are the
changes made in record 3 or record 4?

Thanks!

Mark
"MacDermott" <ma********@nospam.com> wrote in message
news:f2*****************@newsread3.news.atl.earthl ink.net...
Another significant difference is that the Form_Load event occurs after the
data has been loaded into the form.
So if you want to do anything with the data, you need to wait until then.

HTH
- Turtle

"deko" <de**@hotmail.com> wrote in message
news:0Q***********@newssvr27.news.prodigy.com...
Is there a difference between the Form_Open and Form_Load events? When
should I use one rather than the other? I have several forms that require
code to run when they open... or is it when they load?

Thanks in advance.


Nov 12 '05 #5
I think the best way to understand this is to try it and see if it
does what you want. Make a copy of your form and data source to play
with, and see what happens when you put code in one event or the
other. I think this is the fastest way to get a feel for it.

Julia

"Mark" <mm*****@earthlink.net> wrote in message news:<pp*****************@newsread3.news.atl.earth link.net>...
Turtle,

So is there a significant difference between the Load event and the Activate
event. What determines which of these to use?

Say the form moves from record 3 to record 4 and the Current event occurs. If
the current event contains code to make one or more changes to data, are the
changes made in record 3 or record 4?

Thanks!

Mark
"MacDermott" <ma********@nospam.com> wrote in message
news:f2*****************@newsread3.news.atl.earthl ink.net...
Another significant difference is that the Form_Load event occurs after the
data has been loaded into the form.
So if you want to do anything with the data, you need to wait until then.

HTH
- Turtle

"deko" <de**@hotmail.com> wrote in message
news:0Q***********@newssvr27.news.prodigy.com...
Is there a difference between the Form_Open and Form_Load events? When
should I use one rather than the other? I have several forms that require
code to run when they open... or is it when they load?

Thanks in advance.


Nov 12 '05 #6
I would agree with Julia's suggestion on your second question.
(BTW - it's usually a better idea to start a new thread if you want to
bring up a new question.)

As for Load and Activate, consider this scenario:
Form1 has Button1 which runs code:
DoCmd.OpenForm "Form2"
Form2 has Button2 which runs code:
DoCmd.OpenForm "Form3"
you push Button1, see Form2
Form2's Open, Load, and Activate events fire (among others)
Now Push Button2.
Form3 opens, and gets the focus.
Close Form3
Form2 gets the focus, causing its Activate event to fire again.
Since it was already loaded, its Load event does not fire.
Note: If you move to a different application (i.e. MS Word), instead of to
a different Access form, the form's Activate event does not fire when you
return to the Access application.

HTH
- Turtle

"Mark" <mm*****@earthlink.net> wrote in message
news:pp*****************@newsread3.news.atl.earthl ink.net...
Turtle,

So is there a significant difference between the Load event and the Activate event. What determines which of these to use?

Say the form moves from record 3 to record 4 and the Current event occurs. If the current event contains code to make one or more changes to data, are the changes made in record 3 or record 4?

Thanks!

Mark
"MacDermott" <ma********@nospam.com> wrote in message
news:f2*****************@newsread3.news.atl.earthl ink.net...
Another significant difference is that the Form_Load event occurs after the data has been loaded into the form.
So if you want to do anything with the data, you need to wait until then.
HTH
- Turtle

"deko" <de**@hotmail.com> wrote in message
news:0Q***********@newssvr27.news.prodigy.com...
Is there a difference between the Form_Open and Form_Load events? When should I use one rather than the other? I have several forms that require code to run when they open... or is it when they load?

Thanks in advance.



Nov 12 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Frank Rizzo | last post: by
2 posts views Thread by =?Utf-8?B?VG9u?= | last post: by
34 posts views Thread by Smithers | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.