Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 352
  • Last Modified:

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
0
p-plater
Asked:
p-plater
  • 4
  • 3
  • 3
  • +1
2 Solutions
 
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
 
p-platerAuthor Commented:
Sorry - I Didn't state that Excel is Hidden
0
 
NorieData ProcessorCommented:
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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
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
 
NorieData ProcessorCommented:
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
 
NorieData ProcessorCommented:
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

Featured Post

Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

  • 4
  • 3
  • 3
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now