Splash Form - Need Help Coding the 'Close'

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have been doing some reading across this site, and in my Access 2000 Bible. I managed to code my application a nice splash screen, that opens when I launch the Access database. However, I cannot figure out how to get the splash form to close automatically after a few seconds. The only help I got boiled down to adding code to a module or a macro, but I did not know where...in Access, there are several different places to write code. I also tried to use the Access help files in Access 2003 for ideas, but it is a terrible resource and the information is never very helpful. So, in a descriptive way: (1) where in Access do I code the close statements (2) where can I set the timing for this closing event?
 
Hi Jamie,

1. Open your splash form in Design view.
2. Go to the Form's Properties list.
3. On the Event or All tab go to the line that says "Timer Interval" and enter 2000 (which
will be 2 seconds; adjust if needed).
4. On the "On Timer" line click the (...) button to go to the code window.
5. Enter this code in the Form's Timer event:

Private Sub Form_Timer()
On Error GoTo ErrorPoint

If Me.TimerInterval <> 0 Then
Me.TimerInterval = 0
End If

DoCmd.OpenForm "Switchboard"
' Change to whatever is the name of your main form

DoCmd.Close acForm, "Splash Form"
' Change to whatever is the name of this splash form

ExitPoint:
Exit Sub

ErrorPoint:
MsgBox "The following error has occurred:" _
& vbNewLine & "Error Number: " & Err.Number _
& vbNewLine & "Error Description: " & Err.Description _
, vbExclamation, "Unexpected Error"
Resume ExitPoint

End Sub

6. Compile the code, close the form and save.
7. Set your Startup form as the first form to open under Tools--Startup.
8. Close the database.
9. Open the database and your Splash form should show for 2 seconds before closing and
opening your main form.

Hope that helps,
Jeff Conrad
Access Junkie
Bend, Oregon
--Access MVP Matching Game available for download--

Jamie Abbamont said:
I have been doing some reading across this site, and in my Access 2000 Bible. I managed
to code my application a nice splash screen, that opens when I launch the Access database.
However, I cannot figure out how to get the splash form to close automatically after a few
seconds. The only help I got boiled down to adding code to a module or a macro, but I did
not know where...in Access, there are several different places to write code. I also tried
to use the Access help files in Access 2003 for ideas, but it is a terrible resource and
the information is never very helpful. So, in a descriptive way: (1) where in Access do I
code the close statements (2) where can I set the timing for this closing event?
 
Back
Top