display query running in status bar

T

Ted

hi all, is there a way to display the name of the query that is running in
the status bar?

i have code executing that has a bunch of queries running and i'd like to
see which query is running.

TIA
Ted
 
G

George Nicholson

application.SysCmd acSysCmdSetStatus, "MyQueryName"

Be sure to reset the status bar text when done
application.SysCmd acSysCmdSetStatus, " "
(Note: space, not "")
 
T

Ted

Thanks George, is there a way to use a generic piece of code instead of
using "MyQueryName"
i have about 50 queries running and would rather copy and paste something
like

application.SysCmd acSysCmdSetStatus, activeQuery

i tried Application.CurrentObjectName but it only returned the name of the
form that holds the code that runs the queries thru the OpenQuery method.
 
D

Douglas J. Steele

In order to have 50 queries run, you must be calling each query by name. How
are you doing that?
 
T

Ted

Hi Doug,

I'm running them using the OpenQuery Method...

DoCmd.OpenQuery "qryPropertyBIExtraExpenseCovGroup1", acNormal, acEdit
DoCmd.OpenQuery "qryPropertyBIExtraExpenseCovGroup1_CA", acNormal,
acEdit
DoCmd.OpenQuery "qryPropertyBIExtraExpenseCovGroup1_NE", acNormal,
acEdit
DoCmd.OpenQuery "qryPropertyBIExtraExpenseCovGroup1_SE", acNormal,
acEdit
DoCmd.OpenQuery "qryPropertyBIExtraExpenseCovGroup1_WA", acNormal,
acEdit

Do I have to copy and paste application.SysCmd acSysCmdSetStatus,
"MyQueryName"
after each line? Its not mandatory but it takes a while to run and I'd like
to be able to see
where I'm at while its running.
 
G

George Nicholson

'**********
For i = 1 to 50
Select Case i
Case 1
strQueryName = "qryPropertyBIExtraExpenseCovGroup1"
Case 2
strQueryName = "qryPropertyBIExtraExpenseCovGroup1_CA"
'etc

Case 50
strQueryName = "qryPropertyBIExtraExpenseCovGroup1_XYZ"
Case Else
'Optional error message
End Select
Application.SysCmd acSysCmdSetStatus, "Running query " & i & " of 50: "
& strQueryName
Do Events
DoCmd.OpenQuery strQueryName, acNormal, acEdit
Next i
Application.SysCmd acSysCmdSetStatus, " "
'***********
DoEvents might or might not be necessary to let the screen catch up. Won't
hurt.
 

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