Wrox Programmer Forums
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 25th, 2008, 02:59 PM
Registered User
 
Join Date: Aug 2008
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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!






Similar Threads
Thread Thread Starter Forum Replies Last Post
hi i got runtime error 13 Type Mismatch error sriharsha345 Access VBA 2 February 21st, 2008 09:30 AM
Combine fields>Runtime error 2450 Chris333 Access VBA 4 July 6th, 2007 07:10 AM
run-time error '2450' kk_sg Access VBA 2 August 21st, 2006 10:26 AM
Run-time error '2450' bmurrin Access VBA 6 May 31st, 2006 07:11 AM
Can't find subform referred to in VBA Error 2450 mmcdonal Access VBA 2 April 18th, 2005 10:05 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.