Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Startup Form Before database initializes 2

Status
Not open for further replies.

Tinkerers

Technical User
Sep 26, 2002
90
US
Hi,

I have an Access 97 database that runs lots of code, before the main menu appears. This takes alot of time, almost a minute, where the user is staring at an empty screen. I'd like to have a form appear telling the user to "Please Wait" while the database initializes. Once the Main Menu appears, the Please Wait form can then hide.

Any ideas how to make this happen ? I've tried, but the form won't appear until after all the code runs, which is too late !

Thanks,
Paul
 
Why not start with a Gateway form. You press enter to start the application. This runs all your code (do you need that?) and fires up the Main Menu when it has completed

 
Is there any other way to accomplish this, so the user doesn't need to press ENTER?
 
Tinkerers,
How is the code run?
From the autoexec macro or from the startup form?

Note that code in a database's startup form's On Open Event will fire before any code in an autoexec Macro.
Cheers.
 
This takes alot of time, almost a minute, "

how much code is actually running for it to take so long to load up? also what is the code doing?
past experience of slow opening databases was usually cured by carrying out some repairs and compacting the db.

Be ALERT - Your country needs Lerts
 
I think maybe Edski may have hit upon the issue. I am running all this code at the "On Open" event of the Startup Form. The code includes things like searching a large database to see what equipment is in need of cailbration, and a whole slew of other things that is rather time consuming, login info, etc... Also, I compact the db daily.

Hmmm, maybe I should change things around and have the startup form be my "Please Wait" screen. Then, when all the code finishes running, open up my other form and hide the startup form ?
 
Well, I just redesigned so that my startup form is now a "Please Wait" message. But, the form is still not displayed, until after all the code runs in the next form's Load Event. What's up with this ?

How can I make the startup form display first ?

Thanks for any help !
 
How did you redesign the database?

Is your "PLEASE WAIT" form the form that is loaded from the Tools>StartUp>Display Form/Page selection?


"I know what you're t'inkin', ma petite. Dat Gambit... still de suave one, no?"
 
Tinkerers,
You could put all the code in a function that gets called from the autoexec Macro. Keep your startup form with the "Please Wait" message and a nice big cup of steaming coffee!
Cheers.
 
sorry, I just tried that and it didn't quite work. The form loads but doesn't really show much! I'd suggest using a timer event in the startup form to fire the code.
Cheers.
 
i would personally have a splash form set as the startup form then on the open event of the splash form have a second ghost (one that is hidden) open and have the open event of this form trigger all the code to run. set the timer event of the splash form to roughly the same length of time as the code takes to run, and ont he elapse of this time open the switchboard.

Be ALERT - Your country needs Lerts
 
After trying all the different ideas, I ended up going back to using a gateway form. In other words, I set up a splash screen, saying this database will take a minute to initialize, press any key to continue. I used a timer to flash the words "press any key to continue". This way the code stops execution and waits for the keystroke, and the form has time to display.

Thanks for everyone's input !!!!
Paul
 
Tinkerers,

Just a quick note ---

Have a look at this thread to maybe speed up your opening code.

thread702-206410

This thread has been a help to countless masses - hope it helps.

Owen
 
In many of my applications, I have a splash screen that loads when the database is opened. I show a pretty picture and a message like "Please wait .. loading report components" on the form so my users have something to look at.

On this form, I set the timer interval to 1000 and have an on-timer event as follows - this avoids the need for a user to push a button to continue.

Private Sub Form_Timer()
On Error GoTo Err_Form_Timer

** Put your extracts here ***

' close splash and show Main Menu form
DoCmd.Close
DoCmd.OpenForm "frmMainMenu"

Exit_Form_Timer:
DoCmd.SetWarnings True
DoCmd.Hourglass False
Exit Sub

Err_Form_Timer:
MsgBox Err.Description
Resume Exit_Form_Timer
End Sub


Hope this helps [pipe]
 
TheCreator,

Could you elaborate a little more on your *** Put extracts here ***. I don't understand how this stops the code execution and has time to display the splash form.

Thanks,
Paul
 
Tinkerers,

I may be a little late here, But I just set up a simple db to try and simulate what you want and it seemed to work.

Make a splash screen with whatever design you want.

in the "On Open" Event, place the following

Code:
Private Sub Form_Open(Cancel As Integer)

*******Enter Code Here********

me.SetFocus
Docmd.close

Forms!(Your_Switboard).SetFocus

End Sub

Am I close to the mark Here? or Have I missed something?

Cheers

Jedel

 
Hi Tinkerers,

The code wil not run until after your splash screen has loaded because it is reliant in the OnTimer event, not the OnOpen or OnLoad events.

Basically the splash screen form loads and displays to your users, and then after the interval you have set with the timer interval property of the form, this code will fire off.

Hope this helps [pipe]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top