Go Back   Access World Forums > Microsoft Access Discussion > Modules & VBA

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 04-17-2019, 10:34 AM   #1
sxschech
Newly Registered User
 
Join Date: Mar 2010
Posts: 528
Thanks: 19
Thanked 97 Times in 87 Posts
sxschech is on a distinguished road
MsgBox Dialogue and Windows popup dialog

In running a process, I put up a message box with vbokonly to let user know it was completed and to be sure rest of the code did not continue running until other process completed and they then clicked ok. However, today, I noticed that the popup box was briefly covered by the windows popup box which was copying a file. This popup has a Cancel button positioned in same spot where the ok button is on my popup. Since usually things go smoothly, box shows up, click ok and go on to the next thing. Perhaps because the file was bigger, it took longer to copy and here is what happened, my box pops up, I go to click ok, but wait, it says cancel instead, oops, already clicked it as usually the copy happens so quickly don't see the windows popup, (meaning that I clicked the button to cancel copying the file rather than clicking Ok that process was complete). Any thoughts how I can have my popup display only after the windows process finishes, or how I can have the popup display in such a way that the windows popup isn't aligned over mine?

sxschech is offline   Reply With Quote
Old 04-17-2019, 10:40 AM   #2
theDBguy
Iím here to help
 
theDBguy's Avatar
 
Join Date: Oct 2018
Location: SunnySandyEggo
Posts: 1,446
Thanks: 19
Thanked 362 Times in 354 Posts
theDBguy will become famous soon enough theDBguy will become famous soon enough
Re: MsgBox Dialogue and Windows popup dialog

Hi. If you're using a message box to let the user know a file copy process has completed, then maybe you could check if the file exists in the new location first before popping the message. For example, you could try using the Dir() function in a loop and keep looking for a period of time before giving up or showing the message.
__________________
Just my 2 cents...

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
theDBguy is offline   Reply With Quote
Old 04-17-2019, 10:59 AM   #3
June7
Newly Registered User
 
June7's Avatar
 
Join Date: Mar 2014
Posts: 1,512
Thanks: 0
Thanked 367 Times in 366 Posts
June7 will become famous soon enough June7 will become famous soon enough
Re: MsgBox Dialogue and Windows popup dialog

Maybe Sleep and DoEvents would be useful? https://www.fmsinc.com/MicrosoftAcce...idDoEvents.asp

Here is code I used, maybe should use Sleep component but this has always worked just fine:
Code:
        'allow enough time for file to completely copy before opening
        Dim Start As Double
        Start = Timer
        While Timer < Start + 3
            DoEvents
        Wend

__________________
To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression. Attachment Manager is below Advanced editor window, click Go Advanced below Quick Reply window.
DEBUG! DEBUG! DEBUG!
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
June7 is offline   Reply With Quote
Old 04-17-2019, 03:01 PM   #4
sxschech
Newly Registered User
 
Join Date: Mar 2010
Posts: 528
Thanks: 19
Thanked 97 Times in 87 Posts
sxschech is on a distinguished road
Re: MsgBox Dialogue and Windows popup dialog

Thanks to you both for suggestions. At first tried using theDBguy's method. As the file I'm copying is going into a zip, I had to find modify code in order to tell me if the file is in the zip. I tested the function on its own and seemed to work,
then added a loop into the code between the function that adds the file to the zip and the message box saying that the file was added. something like this:

Code:
Do Until IsInZip(zipfilename, covsheet) = True
    Loop
Not sure if in my test I got the file wrong or there was another issue, but it ended up in a never ending loop. Perhaps I need a method to check for the file but have it give up after a certain number of loops or does the loop need to be written differently.

In the meantime, I'll try out June7's approach.

sxschech is offline   Reply With Quote
Reply

Tags
msgbox , popup

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
removing popup Dialog box grenee Forms 2 03-21-2017 06:16 AM
Common Dialog working in Windows XP but not Windows 7 pem406 Modules & VBA 3 05-11-2010 02:12 AM
Force a popup form to the front of other windows application windows Atomic Shrimp Forms 3 12-04-2009 04:38 AM
remove form popup dialog box human_anomaly Forms 1 10-27-2004 07:14 PM
Set up a query to get criteria from a popup dialog joshosu420ok Queries 3 05-13-2002 10:48 PM




All times are GMT -8. The time now is 12:30 AM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Featured Forum post


Sponsored Links


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World