PaulDalyTT
Programmer
Hi folks,
First post on this forum. I finally hit a problem that an existing post here doesn’t seem to explain and help solve!
Can anyone help me ProgressBar in Access?
I have an Access 2003 application which does several steps
1. FTP files
2. Load files
3. Run ~100 queries on data
4. Produce and Email excel spreadsheet
5. Housekeeping
This has been working fine for ages, but I decided to add a progress / status bar to the app so people know it hasn’t just died as it works away. Unfortunately, I can’t get it to work properly!
Essentially for the status bar, at each step, I initialize a form which contains a text box and a progressbar. As each step progresses, I increment the progressbar.
When I am finished one step, I initialize the form again with a new set data. See code below…
There are 2 problems I am experiencing though.
The progress bar does not update when run as part of my VB app. – the first init brings up the form and populates the text but no other updates appear to have any affect. (note that when I test the functions in a stand alone module, the progress bar increments as expected)
When the process finishes (after not updating the progress bar!), Access appears to hang… the normal user interface is not responsive and I have to close access down.
Any ideas???
Cheers
Paul
This is the init proc
Progress bar incrementor
call to init / increment in code
First post on this forum. I finally hit a problem that an existing post here doesn’t seem to explain and help solve!
Can anyone help me ProgressBar in Access?
I have an Access 2003 application which does several steps
1. FTP files
2. Load files
3. Run ~100 queries on data
4. Produce and Email excel spreadsheet
5. Housekeeping
This has been working fine for ages, but I decided to add a progress / status bar to the app so people know it hasn’t just died as it works away. Unfortunately, I can’t get it to work properly!
Essentially for the status bar, at each step, I initialize a form which contains a text box and a progressbar. As each step progresses, I increment the progressbar.
When I am finished one step, I initialize the form again with a new set data. See code below…
There are 2 problems I am experiencing though.
The progress bar does not update when run as part of my VB app. – the first init brings up the form and populates the text but no other updates appear to have any affect. (note that when I test the functions in a stand alone module, the progress bar increments as expected)
When the process finishes (after not updating the progress bar!), Access appears to hang… the normal user interface is not responsive and I have to close access down.
Any ideas???
Cheers
Paul
This is the init proc
Code:
Public Function InitProgressBar(StepDesc As String, PBMax As Integer)
Dim Frm As Form
Dim status As Control
Dim PB As Control
'Dim Left As Control
'Dim Right As Control
DoCmd.Close acForm, "Frm_StatusBox"
DoCmd.OpenForm "Frm_StatusBox"
Set Frm = Forms!Frm_StatusBox
Set status = Frm!StatusBox
Set PB = Frm!ProgressBar
'Set Left = Frm!LeftBox
'Set Right = Frm!Rightbox
Frm.Visible = True
Frm.SetFocus
PB.Max = PBMax
PB = 0
Frm.Repaint
status = StepDesc
Frm.Repaint
End Function
Progress bar incrementor
Code:
Public Function IncrementProgressBar()
Dim Frm As Form
Dim status As Control
Dim PB As Control
'Dim Left As Control
'Dim Right As Control
Set Frm = Forms!Frm_StatusBox
Set status = Frm!StatusBox
Set PB = Frm!ProgressBar
'Set Left = Frm!LeftBox
'Set Right = Frm!Rightbox
PB = PB + 1
Frm.Repaint
Frm.Visible = True
Frm.SetFocus
End Function
call to init / increment in code
Code:
Call InitProgressBar("FTPing Files...", 3)
'ftp file 1
Call IncrementProgressBar
'ftp file 2
.
.
.
etc