Getting erro 2450 when click Access close button to exit.

abzalali

Registered User.
Local time
Today, 15:46
Joined
Dec 12, 2012
Messages
118
Dear Expert,
Getting error '2450' when click Access close button to exit.

Run-time error '2450':
ECN cannot find the referenced form 'frmLogin'.

Note: After login my login form is visible to, cause to get login user id into "frmECN" Form. But When I'm in "frmECN" Form and enter data then close to exit Access main close button I'm getting 2450 error.

Pleas help me
Thank, Mir
 
Can you show the code you are using? Are you sure the visibility of the Form is set to No instead of being closed? Is there a spelling mistake?
 
Dear Sir,
this is my login form code:

Code:
Option Compare Database
Private Sub cmdExit_Click()
    DoCmd.Quit
End Sub


Private Sub Form_Open(Cancel As Integer)
    DoCmd.ShowToolbar "Ribbon", acToolbarNo
    DoCmd.NavigateTo "acNavigationCategoryObjectType"
    DoCmd.RunCommand acCmdWindowHide
    DoCmd.RunMacro "SetDisplayCategory"
    DoCmd.RunMacro "AutoExec"
End Sub

Private Sub txtPassword_AfterUpdate()

'Check that EE is selected
If IsNull(Me.cboUser) Then
    MsgBox "You need to select a user!", vbCritical
    Me.cboUser.SetFocus
Else
    'Check for correct password
    If Me.txtPassword = Me.cboUser.Column(2) Then
        'Check if password needs to be reset
        If Me.cboUser.Column(3) = True Then
            DoCmd.OpenForm "frmPasswordChange", , , "[UserID] = " & Me.cboUser
        End If
        If DLookup("[AccessLevelID]", "tblUser", "[UserID] = " & Forms!frmLogin!cboUser) = 1 Then
            DoCmd.ShowToolbar "Ribbon", acToolbarYes
            Me.Modal = False
        Else
            DoCmd.ShowToolbar "Ribbon", acToolbarNo
            Me.Modal = True
        End If

        DoCmd.OpenForm "frmECN", , , , acFormEdit
        Me.Visible = False
    Else
        MsgBox "Password does not match, please re-enter!", vboOkOnly
        Me.txtPassword = Null
        Me.txtPassword.SetFocus
    End If
End If
End Sub
 
But Login form Modal property yes, When I'm on the ECN form then it happen.
 
Code:
Option Compare Database
Private Sub cmdCP_Click()
If DLookup("[AccessLevelID]", "tblUser", "[UserID] = " & Forms!frmLogin!cboUser) = 1 Then
        DoCmd.OpenForm "frmUser"
        Me.Modal = False
    Else
        MsgBox "You do not have Administrative access!", vbOKOnly
    End If
End Sub

Private Sub Form_BeforeInsert(Cancel As Integer)
    Me.ECNDate = Now()
    Me.User = Forms!frmLogin!cboUser
End Sub

Private Sub Form_Load()
If DLookup("[AccessLevelID]", "tblUser", "[UserID] = " & Forms!frmLogin!cboUser) = 1 Then
        Me.cmdCP.Visible = True
        Me.ChkAllowChange.Visible = True
        Me.cmdDel.Visible = True
        Form.AllowDeletions = True
        Form.AllowEdits = True
    Else
        Me.cmdCP.Visible = False
        Me.ChkAllowChange.Visible = False
        Me.cmdDel.Visible = False
        
        If Me.ChkAllowChange = True Then
            Form.AllowDeletions = True
            Form.AllowEdits = True
        Else
            Form.AllowDeletions = False
            Form.AllowEdits = False
        End If
    End If
End Sub
 

Users who are viewing this thread

Back
Top Bottom