Displaying a "Please wait..." Form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Good afternoon all.

I have a screen that has several subforms and a lot of fields doing queries
at startup (around 107 or so). It takes about 1.5 minutes to complete and I
would like to display a custom form that states what is taking place and it
also gives them tips as to how the form works (since it somewhat complex).

I have my form complete but I am not sure how I could get the form to show
for just that the time that the user is waiting for the queries to finish
executing.

I tried placing a conditional check for the last textbox as to whether its
Control Source was set yet but that either seemed really slow or it just
plain didn't work.

Has anyone done this before or have any ideas as to how I might be able to
go ahead with this?

Thanks everyone and have a great weekend!

Lance
 
in message:
Good afternoon all.

I have a screen that has several subforms and a lot of fields doing queries
at startup (around 107 or so). It takes about 1.5 minutes to complete and I
would like to display a custom form that states what is taking place and it
also gives them tips as to how the form works (since it somewhat complex).

I have my form complete but I am not sure how I could get the form to show
for just that the time that the user is waiting for the queries to finish
executing.

I tried placing a conditional check for the last textbox as to whether its
Control Source was set yet but that either seemed really slow or it just
plain didn't work.

Has anyone done this before or have any ideas as to how I might be able to
go ahead with this?

Hi Lance,

How about some ready-made instructions?

ACC97: How to Create a "Please Wait" Message
http://support.microsoft.com/?id=96989

ACC2000: How to Create a "Please Wait" Message
http://support.microsoft.com/?id=209608

ACC2002: How to Create a "Please Wait" Message
http://support.microsoft.com/?id=290133
 
Thanks for the really quick reply Jeff.

I can't believe that I forgot to check for that on MSDN (DOH! I sometimes
forget that it exists).

I tried it and it works but I think I am going to have to put a timer on the
form to keep it open for a while longer. Unfortunately it closes once the
main form opens and the subform is the one with all of the queries running.
Alternatively, unless I keep checking a field for a value in the macro, I
guess I could change the message box to tell them that processing may cause
delays.

Lance
 
set the timer interval of your frmPleaseWait to 10 or something around there
in the timer event of frmPleaseWait add the following code
me.timerinterval = 0
docmd.openform "frmWithAllTheControls"

instead of opening frmWithAllTheControls open the frmPleaseWait
frmPleaseWait opens frmWithAllTheControls

in you frmWithAllTheControls oncurrent event or elsewhere I'm not sure of
the best location for this, but you want to place it after the form actually
finishes loading and opening

docmd.close acform, frmPleaseWait

if you need to do other things in the oncurrent event you can check first to
see if the frmPleaseWait is open and close it only if it is open.
 
Thanks for adding that TW. Both examples show the same thing and the message
box still disappears after the main form is loaded. As TW stated, I am not
sure where you would put his close form method. I tried just about all I
could think.

Still, it seems that going either route doesn't bog down as much and why
scrolling and pressing any buttons has a bit of lag it is definitely
noticable compared to before.

Maybe I should leave it ultra-slow and let them complain before going this
route. ;)

Thanks for your help guys. It is much appreciated.

Lance
 
I don't know what these other references say, but from your other comments,
it appears that they are not doing the job.

In the main forms Open or Load event, (whereever your code is that runs all
your querys) add a couple of lines of code that open your Please Wait form
and hide your main form. This should be before any of the other code in
this module. I would add an OK button to this form, but hide it initially,
we will make it visible later. In the buttons click event, add some code
that will close the form and make the main form visible again.

docmd.openform "frm_PleaseWait"
me.visible = false

Because you did not open this form with the acDialog argument, the code in
your main form should continue to run. When that code is complete, make the
OK button on your please wait form visible.

Forms("frm_PleaseWait").cmd_OK.visible = true

Another thing you might want to consider is to limit the number of subforms
(you didn't mention it, but I'm assuming you have a tab on your form with
separate subforms on each tab. I have found that you can use a tab control,
but get away with having only a single subform that you display over the
tab, but which is not actually controlled by the tab. Then when you select
a new tab, change the source object for this single subform, so that it acts
like you have multiple subforms, but does not take nearly as long to load
when the form is opened.

Another thing I have found useful when a form takes a long time to render
itself is to put the code I used to put in the Open event of the form in the
timer event. This way, the form gets a chance to be displayed while your
startup code is executing. When I do this, I usually set the forms
RecordSource to blank and then set it in the code I run in the Timer Event.
I initially set the forms timerInterval to about 100, then the first line of
the TimerEvent code resets the TimerInterval to zero to prevent it from
firing again.

HTH
Dale
 
Here is what I did to do something similar.

Whatever the height of your form is (let's say 2 inches), add 2 inches to
the bottom of the form. Drag all of your controls down to the bottom half of
the form. Insert a page break in the form right in the middle (for a 2 inch
form, make it 4 inches, drop the controls down to the bottom half and insert
a page break at 2 inches). In the top 2 inches, put your Please Wait
message. Have the form open as usual, and once the queries are complete
(maybe set up a field that is hidden but the value is "Complete" once all
queries have run). Have the form check itself every half-second or so (on
timer event) to see if the complete field is populated. If it is, have the
form scroll to Page 2. Make sure you disable the scroll bars so a user can't
go to the 1st page and see the Please Wait message, and make sure you turn
off the tab stop if you use a field instead of a label. (Why use a field you
ask? My form says Please Wait... and the elipses "..." grow as the form
runs, reaching their max "Please Wait.........." when the last query runs).

It works awesome for me.
 
Back
Top