Display a Message while a SQL Procedure Runs

Hello
I need to display a Message While a SQL stored procedure runs.

The Procedure is called from the following code

sqlstring = "Execute X_REPRICE_QUOTE " & Val(LBsalesord_hdr_seqno.Caption)
Call ConSQL
SQLEx.Execute sqlstring

I need "Updating" to display while the procedure is running then change to "Update Complete" when the Procedure is complete.

It can be in a userform or what ever

Thanks
p-platerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

zorvek (Kevin Jones)ConsultantCommented:
Use this code:

Application.StatusBar = "Updating..."
sqlstring = "Execute X_REPRICE_QUOTE " & Val(LBsalesord_hdr_seqno.Caption)
Call ConSQL
SQLEx.Execute sqlstring
Application.StatusBar = False

Kevin
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
p-platerAuthor Commented:
Sorry - I Didn't state that Excel is Hidden
0
NorieVBA ExpertCommented:
You could set the status bar like this:
Application.StatusBar = "Updating..."
sqlstring = "Execute X_REPRICE_QUOTE " & Val(LBsalesord_hdr_seqno.Caption)
Call ConSQL
SQLEx.Execute sqlstring
Application.StatusBar = "Update Complete"

Open in new window

You would probably want to reset the status bar once the sub ends, you can do that with this.
Application.StatusBar = False

Open in new window

If you want something more visible then you could create a small userform, add a label and a command button.

Then in the command button's click event change the label caption, call the update sub...
Private Sub CommandButton1_Click()

       Label1.Caption = "Updating..."

       Call UpdateSub

       Label1.Caption = "Update completed."

End Sub

Open in new window

Of course that assumes you have a sub to call.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

TommySzalapskiCommented:
If you don't want to use the status bar then create a userform. Show the userform when the procedure is running and hide it when it's over.
0
zorvek (Kevin Jones)ConsultantCommented:
If Excel is hidden then why do you want to display anything to anyone?

Kevin
0
NorieVBA ExpertCommented:
If you want Excel hiddenIf Excel is hidden then you could use the commandbutton on the userform to hide it

Private Sub CommandButton1_Click()      

   Application.Visible = False 

   Label1.Caption = "Updating..."       

   Call UpdateSub       

   Label1.Caption = "Update completed."

End Sub 

Open in new window

You could have another command button to make Excel visible again, or even quit Excel.
0
TommySzalapskiCommented:
So (in Excel) you would press Alt+F11 to get the VBA code editor to pop up. Click Insert->Userform and put a text label saying "Updating..." or whatever.
Then put code like this around the SQL

UserForm1.Show
'Do code here
UserForm1.Hide

Open in new window

0
p-platerAuthor Commented:
Showing a Userform Stops the code until it is dismissed
0
zorvek (Kevin Jones)ConsultantCommented:
You have to show it non-modally.

Kevin
0
zorvek (Kevin Jones)ConsultantCommented:
UserForm1.Show False
'Do code here
Unload UserForm1

Kevin
0
NorieVBA ExpertCommented:
If you call the code for the update from the userform it will run.
0
TommySzalapskiCommented:
Yes, sorry. I forgot that it would block.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.