By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,482 Members | 2,073 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,482 IT Pros & Developers. It's quick & easy.

msgbox delay

100+
P: 158
Right now i have the user press a button and a file is imported via vba. I would like a message box to pop up and tell the user to "Please Wait". How do i cause this "delay" until the import is complete?

Thanks for any advice!
Aug 8 '08 #1
Share this Question
Share on Google+
5 Replies


missinglinq
Expert 2.5K+
P: 3,532
I don't think you can do this with a messagebox; you'll have to "roll your own."

Create a small form, making it look like a messagebox. Make it PopUp, set Border Style to either Dialog or None, strip all the native controls (divider line, nav buttons, Close Button, etc.) then use code like this in your button:

Expand|Select|Wrap|Line Numbers
  1. Private Sub ImportFile_Click()
  2.   DoCmd.OpenForm "YourPopUpFormName"
  3.   'Code here to import file
  4.   DoEvents
  5.   DoCmd.Close acForm, "YourPopUpFormName"
  6. End Sub
The DoEvents line should keep the form closing command from executing until the file has finished importing.

What kind of files are you importing that take enough time to import that it's noticable?

Linq ;0)>
Aug 8 '08 #2

100+
P: 158
What kind of files are you importing that take enough time to import that it's noticable?

Linq ;0)>[/quote]


just one xls file about 13mb, it takes about 4 or 5 seconds to load. I just dont want the user clicking the button 1000 times. Could i use the doevents cmd in the load event method.

Expand|Select|Wrap|Line Numbers
  1. Private Sub cmdSalesLookup_Click()
  2. msgBox "Please Wait"
  3. Doevents
  4.     DoCmd.TransferSpreadsheet , acSpreadsheetTypeExcel9, "MasterZip", "C:\MasterZip.xls", True
this may not be the exact code, but something similar to this?

Thanks!
Matt
Aug 12 '08 #3

missinglinq
Expert 2.5K+
P: 3,532
No. As I said in my original post, if you want the "Please wait..." message to disappear on its own, when the form is finished being imported, you cannot use a messagebox! A messagebox can only be closed by the user clicking on its appropriate button. In order to do what you want, you'll have to create a small form, following the instructions I gave you, to mimic a messagebox.

To be honest, though, if all you're talking about is 4-5 seconds for this file to import, a messagebox is all I'd fool around with. It will tell them what's going on, and by the time they read your message and click the OK button, the file will probably be through loading. It would be a different story if you were talking about 30-60 seconds or longer.

Linq ;0)>
Aug 12 '08 #4

100+
P: 158
I don't think you can do this with a messagebox; you'll have to "roll your own."

Create a small form, making it look like a messagebox. Make it PopUp, set Border Style to either Dialog or None, strip all the native controls (divider line, nav buttons, Close Button, etc.) then use code like this in your button:

Expand|Select|Wrap|Line Numbers
  1. Private Sub ImportFile_Click()
  2.   DoCmd.OpenForm "YourPopUpFormName"
  3.   'Code here to import file
  4.   DoEvents
  5.   DoCmd.Close acForm, "YourPopUpFormName"
  6. End Sub
The DoEvents line should keep the form closing command from executing until the file has finished importing.

What kind of files are you importing that take enough time to import that it's noticable?

Linq ;0)>

How do you strip off the close min, max buttons and the record navigator in 2003?
Aug 12 '08 #5

P: 1
How do you strip off the close min, max buttons and the record navigator in 2003?
In the properties box for any form, there are yes/no and other choices for each of the form's properties, including those you named. Be sure to click the "All" tab to see all choices. Success.
Oct 13 '08 #6

Post your reply

Sign in to post your reply or Sign up for a free account.