Results 1 to 7 of 7
  1. #1
    Join Date
    Apr 2009
    Posts
    4

    Unanswered: Opening a form after running a spash form.

    I am having trouble figuring out how to have a form open after a splash screen. This is the code I am using, the splash portion runs fine but will not open the second form.

    Option Compare Database
    Option Explicit

    Private Sub Form_Open(Cancel As Integer)

    'When form opens, wait 10 seconds before
    'firing the Timer event
    Me.TimerInterval = 2000
    End Sub


    Private Sub Form_Timer()
    #Const OpenDBWindow = True

    'When the timer event happens, close the form and
    'then expose the Database window or
    'a switchboard form
    DoCmd.Close acForm, "Splash"

    #If OpenDBWindow = True Then
    DoCmd.SelectObject acForm, "Splash", _
    True
    #Else
    DoCmd.OpenForm "Form1"
    #End If

    End Sub

  2. #2
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    According to your conditional logic, under what conditions would the form ever be opened?
    Testimonial:
    pootle flump
    ur codings are working excelent.

  3. #3
    Join Date
    Apr 2009
    Posts
    4
    I am really new to this. I am trying to have this database act as a program and once the splash screen fires I want "Form1" to launch automatically afterward.

  4. #4
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    Why are you using conditional compilation arguments to begin with?

    First: As pootle flump told you, as OpenDBWindow is always true (because of #Const OpenDBWindow = True, the code after the #Else will never be executed.

    Second: It's never a good idea to go on performing code after closing the object that contains this code. If closing a form was instantaneous the code after DoCmd.Close acForm, "Splash" would never be executed as the form that contains it would be closed.

    Have a nice day!

  5. #5
    Join Date
    Apr 2009
    Posts
    4
    Thank you both for the help I was able to figure it out.

  6. #6
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    BTW,

    Me.TimerInterval = 2000

    is going to cause the Timer event to be fired after 2 seconds, not 10 seconds.

    Ten seconds would be

    Me.TimerInterval = 10000
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  7. #7
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    Good. 2 seconds is enough. 10 seconds would make me want to close it before it opens.
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •