Help with Splash Screen VBA please (1 Viewer)

sakhtar

New member
Local time
Yesterday, 21:57
Joined
May 6, 2013
Messages
6
I have a splash screen with a check box. The idea was to ask the user to tick this if they do not wish to see this again. The code I am using in the open and close properties of filed is:

Private Sub Form_Close()
On Error GoTo Form_Close_Err
If Forms!Splash_Screen!Check1 = False Then
CurrentDb().Properties("StartupForm") = "Contacts"
Else
CurrentDb().Properties("StartupForm") = "Splash_Screen"
End If
Exit Sub
Form_Close_Err:
If Err = 3270 Then
Dim db As DAO.Database
Dim prop As DAO.Property
Set db = CurrentDb()
Set prop = db.CreateProperty("StartupForm", dbText, _
"Splash_Screen")
db.Properties.Append prop
Resume Next
End If
End Sub

Private Sub Form_Open(Cancel As Integer)
On Error GoTo FormOpen_Err
If (CurrentDb().Properties("StartupForm") = "Splash_Screen" Or _
CurrentDb().Properties("StartupForm") = "Form.Splash_Screen") _
Then
Forms!Splash_Screen!HideSplash = False
Else
Forms!Splash_Screen!Check1 = True
End If
FormOpen_Exit:
Exit Sub
FormOpen_Err:
If Err = 3270 Then
Forms!Splash_Screen!Check1 = True
Resume FormOpen_Exit
End If

This doesn't seem to work. Any help or advice would be greatly appreciated.

Thanks
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 12:57
Joined
May 7, 2009
Messages
19,229
Code:
Private Sub Form_Load()
    Me!Check1 = Nz(CurrentDb.Properties("StartupForm") = "Splash_Screen", False)
End Sub

Private Sub Form_Open(Cancel As Integer)
    Dim db As DAO.Database
    Set db = CurrentDb
On Error GoTo FormOpen_Err
    If (db.Properties("StartupForm") = "Splash_Screen" Or _
        db.Properties("StartupForm") = "Form.Splash_Screen") Then
        Cancel = True
    End If
FormOpen_Exit:
    Exit Sub
FormOpen_Err:
    If Err = 3270 Then
        Resume FormOpen_Exit
    End If
End Sub

Private Sub Form_Unload(Cancel As Integer)
    On Error GoTo Form_Close_Err
    Dim db As DAO.Database
    Dim prop As DAO.Property
    Set db = CurrentDb
    If Me!Check1 = False Then
        db.Properties("StartupForm") = "Contacts"
    Else
        db.Properties("StartupForm") = "Splash_Screen"
    End If
    Exit Sub
Form_Close_Err:
    If Err = 3270 Then
        Set db = CurrentDb()
        Set prop = db.CreateProperty("StartupForm", dbText, "Splash_Screen")
        db.Properties.Append prop
        Resume Next
    End If
End Sub
 

sakhtar

New member
Local time
Yesterday, 21:57
Joined
May 6, 2013
Messages
6
Thank you for your help.

This has now stopped the Splash screen appear on restarting the DB but I now get an error message as Access as if still looking for the form at startup.

Says "The from name is misspelled or refers to a form that doesn't exist".

Are you able to advise further?
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 12:57
Joined
May 7, 2009
Messages
19,229
remove the splash form from your Option Current Database->Display Form.
create an autoexec macro that will run the splash screen.
 

Users who are viewing this thread

Top Bottom