Results 1 to 11 of 11
  1. #1
    skydivetom is offline VIP
    Windows 8 Access 2010 64bit
    Join Date
    Feb 2019
    Posts
    1,046

    Timed Message Box closes at around 30 seconds (vs. 1 second)

    Hello:

    I need to automatically close an *MS_ACCESS* pop-up message box (modal) after 1-2 seconds.

    I came across a VBA recommendation ("Mr. Excel) which includes a single line of code.

    Code:
    CreateObject("wscript.shell").PopUp "Successfully imported n table(s).", 1, "Import Status"



    Although the solution was posted for the MrExcel forum, I tried it in Access and it does close the message automatically. However, the problem is that it does take approximate 25-30 seconds (vs. 1 second as specified in the VBA line).

    My question: If *", 1, " = ~30 seconds in real time, how can the code be tweaked where a value = "1" (or "2") would truly result in closing the pop-up message within 1 to 2 seconds?

    Attached is a sample DB with single form and command button to test the proposed solution.

    Thank you,
    Tom
    Attached Files Attached Files

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    did you set the form timerinterval = 1000 ? (1 second)

  3. #3
    skydivetom is offline VIP
    Windows 8 Access 2010 64bit
    Join Date
    Feb 2019
    Posts
    1,046
    I don't have a custom form. The form that is included in the DB only includes a command button which -- upon being clicked -- opens a CreateObject("wscript.shell").PopUp message box.

  4. #4
    davegri's Avatar
    davegri is online now Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,413
    The DB works perfectly on my system. Msgbox automatically closes after one second.

  5. #5
    skydivetom is offline VIP
    Windows 8 Access 2010 64bit
    Join Date
    Feb 2019
    Posts
    1,046
    Wow... that's strange. Any thought as to why it may take ~30 secs on my laptop? My computer is not even a year old so it's not that I'm using ancient hardware.

  6. #6
    davegri's Avatar
    davegri is online now Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,413
    Quote Originally Posted by skydivetom View Post
    Wow... that's strange. Any thought as to why it may take ~30 secs on my laptop? My computer is not even a year old so it's not that I'm using ancient hardware.
    Not Really.
    SWAG -
    compact/repair,
    reboot your computer,
    import the form into a new database,
    etc

  7. #7
    skydivetom is offline VIP
    Windows 8 Access 2010 64bit
    Join Date
    Feb 2019
    Posts
    1,046
    Davegri -- I followed your recommendations. Unfortunately, the form still does NOT close within 1 second. I will have to investigate a different method, maybe even using a custom form having the appearance of a message box. Not ideal but probably the only work-around in my case.

    Thank you,
    EEH

  8. #8
    orange's Avatar
    orange is online now Moderator
    Windows 10 Office 365
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    I tried your database with timed form. I stays open about 30 seconds for me.
    Access 365 64 bit Dell laptop Intel I7 2.50 GHz

    I tried this adjustment

    Code:
    Private Sub cmdOpenTimedMessageBox_Click()
    
        'Source:    https://www.mrexcel.com/board/threads/programmatically-clicking-ok-on-message-box.779056/
        'Thread #:  3
        'Post:      "you can create a msgbox that disappears after 1 second"
    
        'Throw message box AND automatically close message box after, e.g., 1 second.
        'CreateObject("wscript.shell").PopUp "Successfully imported n table(s).", 1, "Import Status"
        
        'Problem:  Although the pop-up message box will disappear automatically, it takes approximate 30 seconds (vs. 1 second) for it to close.
        DoCmd.OpenForm "formtest"
    End Sub
    I created a blank form "formtest"

    added these 2 event procedures

    Code:
    Private Sub Form_Open(Cancel As Integer)
    'Set the Form’s Timer to 1 second intervals (1000 tics = 1 Second)
    Me.TimerInterval = 1000
    
    End Sub
    
    Private Sub Form_Timer()
    DoCmd.Close acForm, "formtest"
    End Sub
    And form closes in 1 sec.

    ?????

  9. #9
    skydivetom is offline VIP
    Windows 8 Access 2010 64bit
    Join Date
    Feb 2019
    Posts
    1,046
    Jack -- awesome... yes, based on your suggestion the form "formtest" closes within ~ 1 second.

    I will continue to investigate how to make the blank form "formtest" and display the same information like a Msgbox (e.g., see attached).

    Thanks for chiming in... I will continue working on this tomorrow morning.
    Attached Thumbnails Attached Thumbnails Status Message.jpg  

  10. #10
    skydivetom is offline VIP
    Windows 8 Access 2010 64bit
    Join Date
    Feb 2019
    Posts
    1,046
    Jack -- your proposed solution works great. I mimicked the modal message box via form option. W/ the exception of the Access icon (top left corner), this form almost perfectly matches my default msgbox.

    This issue solved an underlying problem (not part of this thread)... THANK YOU!
    Attached Files Attached Files

  11. #11
    orange's Avatar
    orange is online now Moderator
    Windows 10 Office 365
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Timed compact of Backend Database
    By perryc in forum Forms
    Replies: 6
    Last Post: 10-16-2019, 05:07 PM
  2. Timed Macro
    By RayMilhon in forum Macros
    Replies: 2
    Last Post: 08-14-2015, 11:45 AM
  3. Timed Reminder Box; Event Timer?
    By WEJ in forum Access
    Replies: 6
    Last Post: 05-26-2013, 03:12 PM
  4. Timed Pop up reminder
    By Kananelo in forum Programming
    Replies: 1
    Last Post: 03-02-2011, 12:07 PM
  5. Timed events
    By summitrider in forum Access
    Replies: 2
    Last Post: 08-14-2008, 04:38 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums