Form Event

  • Thread starter Thread starter C Walters
  • Start date Start date
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
 
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?
 
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.
 
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
 
-----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 :)
 
Back
Top