Display message to user while VB code is running

MichaelTaouk

New member
Local time
Today, 18:55
Joined
Dec 10, 2011
Messages
1
I have a subroutine that makes a table. It takes about a minute. I want to display a message telling the user that the process is in progress. When the subroutine is complete, I want the message to disappear with no action from the user. What is the best way to do this?
 
I'd use the timer event of a form, closing it at the end of the process.
 
Hi

You could make a progress bar and update it when certain parts are complete say, every time a new field is created then on every data entry if that is being added too? Why does it take about a minute to create a table?


Cheers


Nidge
 
the simplest way will be to show a nonmodal form saying "Please wait" and close the form when job is finished.
You can't use a modal form as it will halt the code
 
I would expect the call to the Make-Table query to complete before moving on to the next line of code.
 
You should be able to run the Sub from within the Popup ‘frmWait’ Form.
(I don’t have a Query that takes long enough to test it.)

Code:
' In the Popup frmWait Form...
Private Sub Form_Open(ByRef intCancel As Integer)
    
    If Len(Me.OpenArgs) Then
        Me.Visible = True
        DoEvents
    
        Application.Run Me.OpenArgs
    End If
    
    DoCmd.Close acForm, Me.Name

End Sub

Call with…
DoCmd.OpenForm "frmWait", , , , , acDialog, "DoSomething"

Chris.
 
why do you need the DoEvents in the form_open event ?
 
Why don't you post either a sample db or your code for someone to try it out. It seems there are a few people willing to help but everyone's limited.

A sample db would help everyone


Cheers

Nidge
 
G’day Smig.

Without the DoEvents the Form may display with a transparent background.

Little demo of something else I’m working on is attached.
Try the popup button and then un-comment the DoEvents.

Chris.
 

Attachments

michael

if you are running a maketable query, then this is an "atomic" access process. you will see the process's own progress bar, but you cannot interrupt the process for your own purposes.

if you are manually doing this, then you have a variety of ways. If you can pre-count the number of insertions it is better, as you can say, update a field on your own form to say

"processed x of y"

if you can't anticipate how many records, then all you can do is

"processed x"

----
solutions such as opening a warning form, and closing it at the end, and turning on the hourgalss etc, are all variations of this sort of idea.
 

Users who are viewing this thread

Back
Top Bottom