We help IT Professionals succeed at work.

Time a form to only show for 5 seconds

Medium Priority
390 Views
Last Modified: 2012-03-14
I know there is a timer event, but when the main form opens, I want it to only show for 5 seconds and then kick off a process, but can this be done in the form open event?

Private Sub Form_Open(Cancel As Integer)
    strUserId = VBUserName
       
'STOP HERE FOR FIVE SECONDS BEFORE CALLING THE PROCESS


    Call lblLMRDatabases_Click
End Sub
Comment
Watch Question

CERTIFIED EXPERT
Most Valuable Expert 2012
Top Expert 2013

Commented:
Set the timer interval to 5000

and add this to the On Timer event

Docmd.close acform, me.name
CERTIFIED EXPERT
Most Valuable Expert 2012
Top Expert 2013
Commented:
Actually if you need to start the process after the 5 seconds, place both lines of code in the Timer event, not the Open Event:



    Call lblLMRDatabases_Click
   Docmd.close acform, me.name
CERTIFIED EXPERT
Top Expert 2016

Commented:
first you need to add this line in one of your regular modules

option explicit

Public Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)



Private Sub Form_Open(Cancel As Integer)
    strUserId = VBUserName
       
'STOP HERE FOR FIVE SECONDS BEFORE CALLING THE PROCESS

Sleep 5000

    Call lblLMRDatabases_Click
End Su
Sandra SmithRetired

Author

Commented:
This is the version I went with.

Sandra