By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,392 Members | 1,523 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,392 IT Pros & Developers. It's quick & easy.

DoEvents?

P: n/a
I'm trying to make a 'Working' dialog with a rotating hourglass which
displays during a long process. The dialog says hit <Esc> to cancel
the process. If <Esc> is hit, the 'Process' ends and closes the
Dialog (works fine.)

The dialog form has a timer event which sets the Picture of an Image
Control to a series of hourglass bitmaps.

When I open the dialog on its own, the timer event executes as it
should.

When opened as part of a process, the timer event does not appear to
be executing. I also tried rotating the hourglass Image using a loop
and API Sleep in the Load Event of the dialog form.

In both cases whilst the process that opens the dialog form is
running, the dialog code does not run (either Timer or Load Event
Loop).

I tried DoEvents everywhere in the 'Process' but it makes no
difference. What do I need to do to get the Dialog's Timer event to
work during the 'Process'?

TIA

<Clipped 'Process' code>:

Function LongProcess()

DoCmd.OpenForm "frmWorking"
DoEvents 'To let frmWorking open

Do
If GetAsyncKeyState(VK_ESCAPE) Then 'API call to detect escape key
GoTo Exit_Function_LongProcess
End If

'****
do something (actually looping through a DAO recordset)
'****
Loop

Exit_Function_LongProcess:
DoCmd.Close acForm, "frmWorking"
Exit Function
End Function
Nov 13 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.