p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   Access VBA (http://p2p.wrox.com/forumdisplay.php?f=80)
-   -   runtime error 2450 (http://p2p.wrox.com/showthread.php?t=70245)

gotcha123 August 25th, 2008 02:59 PM

runtime error 2450
 
I have a database with a login system.
Every time I want to close the database, I get a runtime error 2450 telling me that it can't find the frmLogin.
I don't know why it says that...
Can anyone help me, please?

code for both forms (frmLogin = Login form and frmStartpagina = start page, coming when you succesfully logged in) is below.

frmLogin:
Code:

Option Compare Database
Option Explicit

Private Sub cmdLogin_Click()

    If IsNull(Me.txtLogin) Then
        MsgBox "Geef uw gebruikersnaam in"
        Exit Sub
    ElseIf IsNull(Me.txtPaswoord) Then
        MsgBox "U moet een paswoord ingeven"
        Exit Sub
    End If

    If Me.txtPaswoord.Value = DLookup("Paswoord", "tblLogin", "Gebruikersnaam = '" & Me.txtLogin.Value & "'") Then
        Me.Visible = False 'Geopend maar niet zichtbaar.
        DoCmd.OpenForm "frmStartpagina", acNormal
    Else
        MsgBox "Ongeldig paswoord", vbExclamation
    End If

End Sub

frmStartpagina
Code:

Option Compare Database
Option Explicit

Private Sub cmdAfsluiten_Click()
    DoCmd.OpenForm "frmLogin"
    DoCmd.Quit acQuitPrompt

End Sub

Private Sub cmdAgenda_Click()
    Const strFullpath As String = "c:\Access cursus\DTC Agenda.mdb"
    Dim accappl As Access.Application

    Set accappl = New Access.Application

    accappl.OpenCurrentDatabase strFullpath
End Sub

Private Sub cmdKracht_Click()
Const strFullpath As String = "c:\Access cursus\Krachtschema.mdb"
    Dim accappl As Access.Application

    Set accappl = New Access.Application

    accappl.OpenCurrentDatabase strFullpath
End Sub

Private Sub cmdLegertesten_Click()
    Const strFullpath As String = "c:\Access cursus\Legertesten.mdb"
    Dim accappl As Access.Application

    Set accappl = New Access.Application

    accappl.OpenCurrentDatabase strFullpath
End Sub

Private Sub cmdLichaamsmetingen_Click()
    Const strFullpath As String = "c:\Access cursus\Lichaamsmetingen.mdb"
    Dim accappl As Access.Application

    Set accappl = New Access.Application

    accappl.OpenCurrentDatabase strFullpath
End Sub

Private Sub cmdMedisch_Click()
    Const strFullpath As String = "c:\Access cursus\Medisch.mdb"
    Dim accappl As Access.Application

    Set accappl = New Access.Application

    accappl.OpenCurrentDatabase strFullpath
End Sub

Private Sub cmdMentaal_Click()
    Const strFullpath As String = "c:\Access cursus\Mentaal.mdb"
    Dim accappl As Access.Application

    Set accappl = New Access.Application

    accappl.OpenCurrentDatabase strFullpath
End Sub

Private Sub cmdScouting_Click()
    Const strFullpath As String = "c:\Access cursus\Scouting 2008.mdb"
    Dim accappl As Access.Application

    Set accappl = New Access.Application

    accappl.OpenCurrentDatabase strFullpath
End Sub

Private Sub cmdSnelheidstesten_Click()
    Const strFullpath As String = "c:\Access cursus\Snelheidstesten.mdb"
    Dim accappl As Access.Application

    Set accappl = New Access.Application

    accappl.OpenCurrentDatabase strFullpath
End Sub

Private Sub cmdTornooiverslag_Click()
    Const strFullpath As String = "c:\Access cursus\Tornooiverslag.mdb"
    Dim accappl As Access.Application

    Set accappl = New Access.Application

    accappl.OpenCurrentDatabase strFullpath
End Sub

Private Sub cmdVideo_Click()
    Const strFullpath As String = "c:\Access cursus\Video.mdb"
    Dim accappl As Access.Application

    Set accappl = New Access.Application

    accappl.OpenCurrentDatabase strFullpath
End Sub

Private Sub cmdVoeding_Click()
    Const strFullpath As String = "c:\Access cursus\Voeding.mdb"
    Dim accappl As Access.Application

    Set accappl = New Access.Application

    accappl.OpenCurrentDatabase strFullpath
End Sub

Private Sub cmdWeekplanning_Click()
    Const strFullpath As String = "c:\Access cursus\Weekplanning.mdb"
    Dim accappl As Access.Application

    Set accappl = New Access.Application

    accappl.OpenCurrentDatabase strFullpath
End Sub

Private Sub Form_Load()

     Dim strLogin As String

' SELECT tblLogin.LoginID, tblLogin.Gebruikersnaam, tblLogin.Paswoord, tblLogin.Weekplanning,
' tblLogin.Tornooiverslag, tblLogin.Scouting, tblLogin.Video, tblLogin.Medisch, tblLogin.Mentaal,
' tblLogin.Voeding, tblLogin.Lichaamsmetingen, tblLogin.DTC_Agenda, tblLogin.Snelheidstesten,
' tblLogin.Kracht, tblLogin.Legertesten
' FROM tblLogin;

    strLogin = Forms("frmLogin").txtLogin
    Me.cmdScouting.Enabled = DLookup("Scouting", "tblLogin", "Gebruikersnaam = '" & strLogin & "'")
    Me.cmdTornooiverslag.Enabled = DLookup("Tornooiverslag", "tblLogin", "Gebruikersnaam = '" & strLogin & "'")
    Me.cmdVideo.Enabled = DLookup("Video", "tblLogin", "Gebruikersnaam = '" & strLogin & "'")
    Me.cmdWeekplanning.Enabled = DLookup("Weekplanning", "tblLogin", "Gebruikersnaam = '" & strLogin & "'")
    Me.cmdMentaal.Enabled = DLookup("Mentaal", "tblLogin", "Gebruikersnaam = '" & strLogin & "'")
    Me.cmdVoeding.Enabled = DLookup("Voeding", "tblLogin", "Gebruikersnaam = '" & strLogin & "'")
    Me.cmdLichaamsmetingen.Enabled = DLookup("Lichaamsmetingen", "tblLogin", "Gebruikersnaam = '" & strLogin & "'")
    Me.cmdKracht.Enabled = DLookup("Kracht", "tblLogin", "Gebruikersnaam = '" & strLogin & "'")
    Me.cmdSnelheidstesten.Enabled = DLookup("Snelheidstesten", "tblLogin", "Gebruikersnaam = '" & strLogin & "'")
    Me.cmdLegertesten.Enabled = DLookup("Legertesten", "tblLogin", "Gebruikersnaam = '" & strLogin & "'")
    Me.cmdAgenda.Enabled = DLookup("DTC_Agenda", "tblLogin", "Gebruikersnaam = '" & strLogin & "'")
    Me.cmdMedisch.Enabled = DLookup("Medisch", "tblLogin", "Gebruikersnaam = '" & strLogin & "'")

End Sub

Thanks in advance for your help!



All times are GMT -4. The time now is 08:35 AM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.