[AccessD] Prompt after Form loads

Heenan, Lambert Lambert.Heenan at aig.com
Wed Sep 1 15:57:50 CDT 2004


The Activate event should do the trick, you just need to keep tack of how
many times it fires. I just tried this out with a form/subform setup, and
the following code seems to work just fine

Private Sub Form_Activate()
 Static lngLoaded As Long
    lngLoaded = lngLoaded + 1
    DoEvents
    If lngLoaded > 1 Then MsgBox "Hello " 
End Sub

The DoEvents does not seem to be necessary, but I thought I'd put it in
anyway. 

What I found was that the entire form and subform was displayed with the
exception of some controls on the form which have statements like this...

=Count([cFaceAmount])

... in their control source property.

This was Access 97

Lambert

> -----Original Message-----
> From:	accessd-bounces at databaseadvisors.com
> [SMTP:accessd-bounces at databaseadvisors.com] On Behalf Of Francisco Tapia
> Sent:	Wednesday, September 01, 2004 3:04 PM
> To:	Access Developers discussion and problem solving
> Subject:	Re: [AccessD] Prompt after Form loads
> 
> I know but if I use the OnCurrent Event, it fires before the form is
> even drawn up on the screen, I have code in the Form_Load event, and
> added a simple "TEST" messagebox to the OnCurrent Event, and found
> that it does not FIRE after the form is visible, instead the user will
> be prompted IF they want to OverRide data w/ Defaults before they can
> read the data, the Timmer control helps to avoid this.... :(
> 
> The code in the Form_Load Event opens recordsets to load into the
> primary form, calls a subform and listbox to load.  When it ends, I'd
> figure that the form would display but it does not. OnCurrent and
> OnActivate also fire before the form is visible... so it appears that
> the only solution is to leave this on the OnTimer event.
> 
> On Wed, 1 Sep 2004 19:59:41 +0200, Gustav Brock <gustav at cactus.dk> wrote:
> > Hi Francisco
> > 
> > It's not quite the same.
> > The counter counts to one, then runs your code.
> > No Timer fiddling.
> > 
> > /gustav
> > 
> > 
> > 
> > 
> > > just the same I did it as a boolean static
> > 
> > > so
> > > Static blnINIT As Boolean
> > > IF blnINIT = FALSE then
> > >    <code>
> > >     blnINIT = TRUE
> > > Endif
> > 
> > > On Wed, 1 Sep 2004 19:11:43 +0200, Gustav Brock <gustav at cactus.dk>
> wrote:
> > >> Hi Francisco
> > >>
> > >> > Why a counter?
> > >>
> > >> Form loads => 1
> > >> Form hits current first time => 2
> > >>
> > >> So:
> > >>
> > >>   If lngCounter = 2 then
> > >>     <your code>
> > >>   End If
> > >>   lngCounter = lngCounter + 1
> > >>
> > >> /gustav
> > >>
> > >> >> But replace the Boolean with a counter: one, two ...
> > 
> > --
> > _______________________________________________
> > AccessD mailing list
> > AccessD at databaseadvisors.com
> > http://databaseadvisors.com/mailman/listinfo/accessd
> > Website: http://www.databaseadvisors.com
> > 
> 
> 
> -- 
> -Francisco
> -- 
> _______________________________________________
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com



More information about the AccessD mailing list