Form Event question

J

Jeff

Hello,

I want to be able to do some logic as soon as a Form Opens but before a user
has the ability to do anything yet.

I tried putting the logic I want in the Form_Load Event, but this Event is
triggered before the Form actaully Opens & is shown on the screen.

I also tried these Events
Open
Load
Resize
Activate
Current

& all the same thing. All of these are executed before the actual Form is
Open & displaying.

Where can I put my code, in what Event, or any other way, so that it is only
executed after the Form is showing on the screen & before the user has the
ability to do anything.

Any help would be greatly appreciated.

Thank you,
Jeff
 
V

Van T. Dinh

Activate Event. This is where the Form is activated, i.e. becoming the
active data object.

However, I am not sure what processing you need in your code to be this
specific. Generally, if it is data related, I use Open or Load Event and I
mainly use Activate Event to maximize / retore / resize the Form. Note that
some statement may actually force a later event to fire while the statement
is executed in an earlier event.

HTH
Van T. Dinh
MVP (Access)
 
J

Jeff

Hi Van,

I appreciate your time to respond, but if you notice I put that I tried the
Activate Event & that doesnt work. This Event is triggered before the form
actually opens on the screen.

Maybe if I am more clear & more simple.

Lets say all the code I want is:
Msgbox "Form is now open"

And I want this message to appear only after the Form is showing on the
screen, but before then the user has the ability to do anything.
So for example:
Form opens, displays message, then user can start their wok.

Any ideas on how to do this ?

Thank you,
Jeff
 
V

Van T. Dinh

In that case, I wouldn't use one of the Form's Events. I would use
something like:

DoCmd.OpenForm "MyForms"
DoEvents
MsgBox " ... "

HTH
Van T. Dinh
MVP (Access)
 
R

Rick Brandt

Jeff said:
Hi Van,

I appreciate your time to respond, but if you notice I put that I tried the
Activate Event & that doesnt work. This Event is triggered before the form
actually opens on the screen.

Maybe if I am more clear & more simple.

Lets say all the code I want is:
Msgbox "Form is now open"

And I want this message to appear only after the Form is showing on the
screen, but before then the user has the ability to do anything.
So for example:
Form opens, displays message, then user can start their wok.

Any ideas on how to do this ?

You can use the Timer event and then set the TimerInterval value to zero as the
last line so it only runs once.
 
D

David

Jeff,
Another option I use is to open the form hidden, execute the code and then
unhide the form.
 
Top