Progress Meter

J

JimP

I have a pass through query that runs a stored procedure in a SQLServer db.
The sp can take several minutes to run on a large db.

Is there a way to display a progress meter while the sp is running?
 
D

Douglas J. Steele

Not really, because I don't believe you'll get any meaningful indicators
from SQL Server as to how much has been completed.
 
J

JimP

Thanks, I pretty much figured that would be the case. I have a message box
warning them it could take awhile instead.
 
D

Douglas J. Steele

Depending on how you're running your code, using a message box may not be
the best idea, as they're modal (meaning that other processing stops until
the message box is dismissed). You may simply want to create a form with an
appropriate message and display that instead (closing it when you know that
the proc is done).

You might always want to set the hourglass on as a visual reminder.
 
T

Tom van Stiphout

On Sat, 12 Jan 2008 07:08:23 -0600, "JimP"

Douglas is right. However in some situations you can rewrite the sproc
to process a chunk at a time. In this case we pass in the low and high
ID value, and have the sproc only process the given range:
exec long_sproc 1, 1000
'update progress meter
exec long_sproc 1001, 2000
'update progress meter
'etc.

-Tom.
 
J

JimP

I tried a form and couldn't get it to display until after the sp was
completed - the code went right into the sp. Opening up the form dialog
seemed to be the same as the msgbox.

I'll try some of the other suggestions as well.
 
D

Douglas J. Steele

Put a DoEvents statement between the DoCmd.OpenForm statement and whatever
statement you're using to run the stored procedure.
 
J

JimP

...will do, thanks.


Douglas J. Steele said:
Put a DoEvents statement between the DoCmd.OpenForm statement and whatever
statement you're using to run the stored procedure.
 

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