query progress meter

B

Bob White

Access provides a progress meter by using varReturn =
SysCmd(acSysCmdInitMeter, strMsg, lngCount), etc. I have used this as
recommended to provide the user with a sense that something is happening. I
am running a lengthy append query (20 or 30 seconds) at database startup.
In the Main Menu form (first form to open) _OnLoad event, I run the query,
and I am trying to use the progress meter while this query is running. I am
using the form's OnTimer event to increment a counter used to update the
SysCmd meter. As near as I can tell, the timer event isn't hitting while
the query is running. It appears that Access totally halts while the query
is running. Is there some way that I can show a status bar progress meter
while a query is running?

Thanks,
Bob White
 
B

Bob White

Hi Arvin,
My problem is that I'm not looping through a recordset, I'm running a canned
query. No code appears to execute while the query is running, so I don't
know how to make the progress meter increase. If I just start it before the
query is executed, all I can do is move the meter to 100% after the query
finishes executing. That's why I tried the timer event, but it doesn't run,
either (I think, I'm hoping I'm wrong here).
Thanks,
Bob
 
A

Arvin Meyer

Bob White said:
Hi Arvin,
My problem is that I'm not looping through a recordset, I'm running a canned
query. No code appears to execute while the query is running, so I don't
know how to make the progress meter increase. If I just start it before the
query is executed, all I can do is move the meter to 100% after the query
finishes executing. That's why I tried the timer event, but it doesn't run,
either (I think, I'm hoping I'm wrong here).
Thanks,
Bob

I think you may be right. The last time I used a timer event was the Timer
control in VB4 probably before Access 97. I can't remember for sure but
there were issues then, although I think they were solved because it was a
control event, not a form event. If you knew how long it would take, you
could probably construct a loop that moved 100 increments (0-100%) at the
same speed.
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access Downloads
http://www.datastrat.com
http://www.mvps.org/access
 
R

Randy

Bob said:
Access provides a progress meter by using varReturn =
SysCmd(acSysCmdInitMeter, strMsg, lngCount), etc. I have used this as
recommended to provide the user with a sense that something is happening.
I
am running a lengthy append query (20 or 30 seconds) at database startup.
In the Main Menu form (first form to open) _OnLoad event, I run the query,
and I am trying to use the progress meter while this query is running. I
am
using the form's OnTimer event to increment a counter used to update the
SysCmd meter. As near as I can tell, the timer event isn't hitting while
the query is running. It appears that Access totally halts while the
query
is running. Is there some way that I can show a status bar progress meter
while a query is running?

Thanks,
Bob White

Bob, you never posted the query or type of query you want the progress bar
for.

-Randy
 
B

Bob White

Arvin Meyer said:
I think you may be right. The last time I used a timer event was the Timer
control in VB4 probably before Access 97. I can't remember for sure but
there were issues then, although I think they were solved because it was a
control event, not a form event. If you knew how long it would take, you
could probably construct a loop that moved 100 increments (0-100%) at the
same speed.
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access Downloads
http://www.datastrat.com
http://www.mvps.org/access
I can measure how long the query takes, but I can't get a loop to execute
while the query is running. It seems like EVERYTHING stops until the query
is done. I've tried a lot of variations at this point. I found some code
from a nz site on a google search that claimed to run the progress meter
during query execution, but it didn't work. I've been working this control
event versus form event concept, to no avail. I'm running Access 97. In
the meantime, I've broken the query into parts and am able to show a jerky
progress meter by updating it between the different queries. It bothers me
to realize that I have seen similar clunky meter movement in other programs.
You'd think there would be a way.
Bob
 
R

Randy

Bob said:
I can measure how long the query takes, but I can't get a loop to execute
while the query is running. It seems like EVERYTHING stops until the
query
is done. I've tried a lot of variations at this point. I found some code
from a nz site on a google search that claimed to run the progress meter
during query execution, but it didn't work. I've been working this
control
event versus form event concept, to no avail. I'm running Access 97. In
the meantime, I've broken the query into parts and am able to show a jerky
progress meter by updating it between the different queries. It bothers
me
to realize that I have seen similar clunky meter movement in other
programs.
You'd think there would be a way.
Bob

Bob, what query or kind of query are you trying to execute?

-Randy
 
A

Arvin Meyer

VB/VBA is sequentially run code. What you will need to do is suspend that
briefly while you take the time to update your meter. Try using "DoEvents"
inside the loop to relinquish control of the thread to the Operating System
and other threads. It may be just the ticket you need.
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top