Form Event

C

C Walters

Hi all,

What event or trick can I use to run code after the form
is open and displayed?

I'm trying to calculate a sum on the form (done, no
problem there) and then check to see if that sum is over a
certain amount (let's say 100). If the sum is > 100 then
I want to display a msgbox "You screwed up, you went over
100 fix the stuff", kind of thing. Right now I can't find
an event or sequence of events that will run after the
form is open and displayed, it always displays the message
before you see the form.

Any ideas are appreciated,

Cheryl
 
D

Dirk Goldgar

C Walters said:
Hi all,

What event or trick can I use to run code after the form
is open and displayed?

I'm trying to calculate a sum on the form (done, no
problem there) and then check to see if that sum is over a
certain amount (let's say 100). If the sum is > 100 then
I want to display a msgbox "You screwed up, you went over
100 fix the stuff", kind of thing. Right now I can't find
an event or sequence of events that will run after the
form is open and displayed, it always displays the message
before you see the form.

Any ideas are appreciated,

Cheryl

Have you tried the Current event? Is this a form that will be
displaying multiple records? Is the form in single-form view, or in
continuous forms or datasheet view?
 
G

Guest

Yes, I have tried the OnCurrent event, but the message
still pops up before the form is displayed. It is a
continous form with multiple records being displayed for
the user to pick from. I've tried putting loops in, in
hopes of stalling the message from being dispalyed, but
have had no luck.
 
D

Dirk Goldgar

Yes, I have tried the OnCurrent event, but the message
still pops up before the form is displayed. It is a
continous form with multiple records being displayed for
the user to pick from. I've tried putting loops in, in
hopes of stalling the message from being dispalyed, but
have had no luck.

Hmm. If it's a continuous form, you're not going to want to use the
Current event. Try this: use the Load event, but before you display
your msgbox, tell the form to make itself visible; e.g.,

Private Sub Form_Load()

Me.Visible = True
MsgBox "Hey, you made a mistake!"

End Sub
 
C

C Walters

-----Original Message-----
-----Original Message-----


Hmm. If it's a continuous form, you're not going to want to use the
Current event. Try this: use the Load event, but before you display
your msgbox, tell the form to make itself visible; e.g.,

Private Sub Form_Load()

Me.Visible = True
MsgBox "Hey, you made a mistake!"

End Sub

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)


.
Excellent idea - worked like a charm! Thanks :)
 

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