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

Progress Bar Help, Please!

matrekz42
P: 33
Hello there,

I currently have a form that has a button to run multiple queries and I want to add a bar to show the user the progress. I tried using the Microsoft Progress Bar Control 6.0, but I'm a VB "NEWB", and cannot figure it out... I have the following code and I would like to execute the progress bar once the "Run" button is clicked, what should I do? Thank you in advance, please find the code below:

Private Sub Run_Click()
DoCmd.Hourglass True
'Turns off the Access warning messages
DoCmd.SetWarnings False

Dim stDocName As String

stDocName = "Query_Name1"
DoCmd.OpenQuery stDocName, acNormal, acEdit

stDocName = "Query_Name2"
DoCmd.OpenQuery stDocName, acNormal, acEdit

stDocName = "Query_Name3"
DoCmd.OpenQuery stDocName, acNormal, acEdit

DoCmd.Hourglass False
'Turns the Access warning messages back on
DoCmd.SetWarnings True
End Sub
Sep 19 '07 #1
Share this Question
Share on Google+
5 Replies


FishVal
Expert 2.5K+
P: 2,653
Hi, there.

ProgressBar object has Value property which can accept values from 0 to 100.
So do smthng like the following (assumed the ProgressBar control, let us say [MyProgress] is on the same form where [Run] button is)
Expand|Select|Wrap|Line Numbers
  1. Me![MyProgress].Value = < percent of progress >
  2.  
Take a look also at this article
How to Use a Progress Meter in Access
Sep 19 '07 #2

matrekz42
P: 33
Hi, there.

ProgressBar object has Value property which can accept values from 0 to 100.
So do smthng like the following (assumed the ProgressBar control, let us say [MyProgress] is on the same form where [Run] button is)
Expand|Select|Wrap|Line Numbers
  1. Me![MyProgress].Value = < percent of progress >
  2.  
Take a look also at this article
How to Use a Progress Meter in Access
Hi, thank you for your response, the Progress Bar is in the same Form as the Run button, however I do not understand your reply, I apologize. Where would I put that in the code, and do I need to put any additional code or set the values first? Im really new to this...
Sep 19 '07 #3

FishVal
Expert 2.5K+
P: 2,653
Hi, thank you for your response, the Progress Bar is in the same Form as the Run button, however I do not understand your reply, I apologize. Where would I put that in the code, and do I need to put any additional code or set the values first? Im really new to this...
You should put this code where you want the progressbar to reflect the progress.
Between DoCmd.OpenQuery statements for example.
Just note that no code will run while query is being opened, so you cannot reflect the progress of query opening, only overall sequence progress.

example
Expand|Select|Wrap|Line Numbers
  1. Private Sub Run_Click()
  2.      DoCmd.Hourglass True
  3.      'Turns off the Access warning messages
  4.       DoCmd.SetWarnings False
  5.  
  6.     Dim stDocName As String
  7.  
  8.     stDocName = "Query_Name1"
  9.     DoCmd.OpenQuery stDocName, acNormal, acEdit
  10.     Me![MyProgress].Value =33
  11.  
  12.     stDocName = "Query_Name2"
  13.     DoCmd.OpenQuery stDocName, acNormal, acEdit
  14.     Me![MyProgress].Value =66
  15.  
  16.     stDocName = "Query_Name3"
  17.     DoCmd.OpenQuery stDocName, acNormal, acEdit
  18.     Me![MyProgress].Value =100
  19.  
  20.     DoCmd.Hourglass False
  21.         'Turns the Access warning messages back on
  22.         DoCmd.SetWarnings True
  23. End Sub[/quote]
  24.  
Sep 19 '07 #4

matrekz42
P: 33
Awesome! Thank you, it worked!
Sep 19 '07 #5

FishVal
Expert 2.5K+
P: 2,653
Awesome! Thank you, it worked!
You are welcome.

Best regards,
Fish
Sep 19 '07 #6

Post your reply

Sign in to post your reply or Sign up for a free account.