Bear with me if I use the wrong terms.
I am trying to wrap my head around how I can execute a series of events within one function or block of code and have a delay/pause in between each.
I have successfully been able to accomplish this by attaching the code to a button on a form but what I really want is for the code to execute when the form opens/loads/activates (don't know which one is appropriate).
Right now if I attach the code to the form load or open event, the code executes and then the form opens; bottom line: the user does not get to see the code execute.
Here is the code I currently have in my form. I also attached a link to a sample db that contains the form in question.
-------------------------------------------------------------------------
' ************************************************** **
' This is the pause function in between each of the progress bar
' increments and the text that changes during the progress bar load
'
' Credit for this function goes to ghudson
' from http://www.access-programmers.co.uk/...ad.php?t=94302
' ************************************************** **
Public Function Pause(NumberOfSeconds As Variant)
On Error GoTo Err_Pause
Dim PauseTime As Variant, Start As Variant
PauseTime = NumberOfSeconds
Start = Timer
Do While Timer < Start + PauseTime
DoEvents
Loop
Exit_Pause:
Exit Function
Err_Pause:
MsgBox Err.Number & " - " & Err.Description
Resume Exit_Pause
End Function
-----------------------------------------------------------------------
' *************************************************
' This is the the actual code for the progress bar and progress text
' *************************************************
Private Sub progressBar_Click()
If Me.lbl1.Visible = False Then
Me.lblProgress.Caption = "Verifying Username......"
Pause (0.5)
Me.lbl1.Visible = True
Pause (0.5)
Me.lbl2.Visible = True
Pause (0.5)
Me.lblProgress.Caption = "Verifying password......"
Pause (0.5)
Me.lbl3.Visible = True
Pause (0.5)
Me.lbl4.Visible = True
Pause (0.5)
Me.lblProgress.Caption = "Verifying database rights......"
Pause (0.75)
Me.lbl5.Visible = True
Pause (0.75)
Me.lbl6.Visible = True
Pause (0.75)
Me.lblProgress.Caption = "Setting user database rights......"
Pause (0.75)
Me.lbl7.Visible = True
Pause (0.75)
Me.lbl8.Visible = True
Pause (0.75)
Me.lbl9.Visible = True
Pause (0.5)
Me.lblProgress.Caption = "User Validated... Loading Main Menu"
Pause (0.5)
Me.lbl10.Visible = True
Pause (0.5)
DoCmd.Close acForm, "FrmSplashScreen"
DoCmd.OpenForm "Switchboard", acNormal
Else
DoCmd.Close acForm, "FrmSplashScreen"
End If
End Sub
Suggestions?
Sean
http://www.mediafire.com/?gh12fd8dd59ks7u