Reputation: 1676
I have a button in my access form ,when clicks it checks some code to find data in excel cells. It is taking a while to finish the process. By that time i need to display Please wait message to users.
I'm calling this method, but not working
Sub plswaitmsg()
Dim statusmsg As Variant
statusmsg = SysCmd(acSysCmdRemoveMeter)
statusmsg = SysCmd(acSysCmdSetStatus, "Loading dropdown data,please wait.")
End Sub
Upvotes: 4
Views: 27378
Reputation: 1
Here is a very easy way:
The true process ending time is latest code line.
Upvotes: -1
Reputation: 12728
You could use this status bar in execution mode. http://christopherjmcclellan.wordpress.com/2014/03/08/progress-bar-for-ms-access/
It's a bit much to post here in it's entirety, but it relies on two big things. The first is that you can create a new instance of any form on the fly in your code. This hinges on the fact that Access forms are really just glorified class modules. You can try it yourself by saving a new form with the default name "Form1", and then placing this code in a regular *.bas module.
Sub ShowForm()
Dim frm as New Form_Form1
frm.Visible = True
Stop
End Sub
Note that I put a breakpoint in because the form will auto-destruct when it goes out of scope.
The second big thing is using DoEvents
to give the OS enough time to repaint the screen.
Understanding these two things, you should be able to design a form with a textbox that changes size as your process runs. Also, I would actually recommend a UserForm instead of an Access Form. I didn't know it at the time, but you can use UserForms not just in Excel, but also in Access.
Upvotes: 3
Reputation: 3272
You cant display a MsgBox in Excel without pausing execution of the marco. You should use the Status Bar to display the message
Application.StatusBar = "Please be patient..."
then to clear it
Application.StatusBar = False
Upvotes: 2