PDA

View Full Version : [SOLVED:] Please wait dialog



avgnick
03-16-2007, 11:45 AM
I'm trying to create a dialog box/window that tells the user that processing is occuring and then closes when processing is done. I've seen code related to using time related intervals but the problem is that the processing time is completely dependent upon the users input and cannot be deteremined. Any help would be much appreciated.

OBP
03-16-2007, 11:51 AM
avgnick, what user input is the processing time dependent upon?

avgnick
03-16-2007, 11:55 AM
it's bunch of information to perform a query in Oracle. Unfortunately due to the nature of my work I'm unable to disclose the details but basice the more criteria that the user puts in the better as Oracle can find the necessary records faster but if the leave very little input it takes Oracle longer to find the necessary records. The query also does some daisy chain searching (A relates to B which relates to C...etc). So the Oracle query is the part that is unkown.

OBP
03-16-2007, 12:10 PM
Assuming that this query is started from a Form there are 2 methods that I would use, either seperately or together.
The first is to use the "Status Bar" at the bottom of the screen.
This is the code for a typical message -


Forms("frmImport").cmdGetSource.StatusBarText = "Transferring Worksheet Data."

The other way to do this is to have a Simple Label set to Invisible, when the Query is started make the Label visible. When the Query has finished change the label's caption to Completed or make it invisible.

avgnick
03-16-2007, 02:50 PM
I've thought about your suggestions before but the requirements given to me are to use a popup dialog box. So I've actually solved the problem (kind of) with the following code.


Dim form1 As New Form
Set form1 = Form_frmWait
form1.Visible = True
form1.Modal = True
form1.repaint
Execute code that the user needs to wait for.
form1.Visible = False
form1.Modal = False
Set form1 = Nothing

There's still a problem which is that the code executes too fast and the code where the user has to wait causes Access to freeze and the popup (form1) has not finished painting and I only see the shell of the window. I wonder if there is some way that form1 can tell the other form that it's finished painting and to proceed with the other code. Hopefully that was a clear enough explanation.

So I figured out a way to make sure that the form has been completely loaded before continuing with the rest of the code. I simply repainted (seen in the code above in red) before continuing with the rest of the code.