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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DoCmd.Hourglass does not work

Status
Not open for further replies.

furrymonster

Programmer
May 5, 2002
6
US
This is the whole code for btnOpenYAF_Click,
yet when the button is clicked the hourglass never appears:

DoCmd.Hourglass True
DoEvents
DoCmd.OpenForm "frmYAF"
DoCmd.Hourglass False

There is also a "DoCmd.Hourglass True" in the Form_Open on frmYAF (where all the time is spent)
It seemed vaguely like a "timing" issue
so I added the "DoEvents" but it does not help.

The hourglass does appear if I am stepping through the code in debug mode.

Any ideas?
Thanks again.




 
Could it simply be that your event is so fast that you never had time to see the hourglass? Put a "Wait" command in the middle of the Hourglass event to make sure it's there.
 
Your problem is at the "DoCmd.Openform" line.

You are opening that form, but because you haven't opened it as a "dialog" box any/all code which follows the DoCmd.Openform line continues to process and so the DoCmd.HourGlass False line which follows is processed simply turning the hourglass off.

If you DO want your code to "stop" whilst "frmYAF" is open, then the DoCmd.Openform "frmYAF" line MUST be changed to either of the following:

DoCmd.OpenForm "frmYAF", , , , , acDialog

DoCmd.OpenForm "frmYAF", WindowMode:=acDialog

The first one has the parameters as "positional";, the second uses "parameter-definition" (non-positional/non-ordered)

In both cases, your form "frmYAF" will be opened up and ALL processing from your "calling" procedure will "pause" UNTIL "frmYAF" is closed.
 
That would be nice but
it already takes a few seconds to run.
That is why it is disorienting when there is no hourglass.
Thanks for the idea.
 
Reply to Archery:
Thanks, I tried this just now:
DoCmd.OpenForm "frmYAF",WindowMode:=acDialog

Unfortunately it does not change the behaviour of the hourglass. However the comma-shortcut is a handy trick I had not known before, thanks.

 
Reply to Archery:
I have also tried just:
DoCmd.Hourglass True
DoEvents
DoCmd.OpenForm "frmYAF"

(moved the "DoCmd.Hourglass False"
to the end of Form_Open on frmYAF)

Still no hourglass.
Again, thank you for your help.
 
How long does it take your form to appear? If it is only a matter of seconds, then the hour glass will not be visible. In any case try doing the following:

Screen.MousePointer = vbHourglass
DoEvents
DoCmd.OpenForm "frmYAF"
Screen.MousePointer = vbDefault
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top