Access Progress bar for VBA processing?

jonathanchye

Registered User.
Local time
Today, 22:22
Joined
Mar 8, 2011
Messages
448
Hi all,

I've managed to get my hands on some code examples for progress bars but they all rely on a preset countdown value. For example the value of 60000 will show a progress bar that takes around a minute to countdown.

I am wondering if there is a way to invoke system based values. I am asking because I have a VBA code that takes around 10-15 seconds to run (calculations) depending on machine capabilities and network speed. Is there a way to show a progress bar telling users % of the current calculation process?

Thank you.
 
What do you mean by "system based values"? Access and the system would have no way to know how long your process should take to run unless you tell it. A progress bar can only show a percentage complete of a known value or known set of steps, ever wonder why you run a query and it will show 99% complete and sit there for a long time, it got to the last step and the last step could take longer than the entire rest of the process, doesn't always happen but it can.
 
What do you mean by "system based values"? Access and the system would have no way to know how long your process should take to run unless you tell it. A progress bar can only show a percentage complete of a known value or known set of steps, ever wonder why you run a query and it will show 99% complete and sit there for a long time, it got to the last step and the last step could take longer than the entire rest of the process, doesn't always happen but it can.

True. I was wondering if VBA could access WinAPI functions but that would be too complex and not necessary.

However, reading your reply I have another question. Let's say I have a procedure called "CalculateMe". This procedure in turn calls 10 sub procedures like CalcArea, CalcWeight, CalcHeight, CalcSpeed etc etc which are mainly calculations and dlookups.

So the "steps" here would be 10. Can I somehow create a progress bar that counts to 10 and increment by 1 each time a sub procedure finish processing?

Would the code be somethine like this?

CalcArea()
increment counter by 1
CalcWeight()
increment counter by 1
etc

So the counter would only increment once the code above it finishes running?
 

Users who are viewing this thread

Back
Top Bottom