Brad_Newman
New member
- Local time
- Tomorrow, 02:25
- Joined
- Jul 29, 2013
- Messages
- 5
Hi All,
I am pretty new to access so i am using a very basic function structure to open a navigation form using if-then-else condition,
Below is my VB coding;
-----------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------
I am getting an run time error '2467': "The Expression you entered refers to an object that is closed or doesn't exist"
Can anyone help me out ??
I am pretty new to access so i am using a very basic function structure to open a navigation form using if-then-else condition,
Below is my VB coding;
-----------------------------------------------------------------------------------------------
Code:
Option Compare Database
Private intLogonAttempts As Integer
Private Sub Emp_Exit_Click()
DoCmd.Quit
End Sub
Private Sub EmpLogin_Click()
'Check to see if data is entered into the UserName combo box
If IsNull(Me.Username) Or Me.Username = "" Then
MsgBox "You must enter a User Name.", vbOKOnly, "Required Data"
Me.Username.SetFocus
Exit Sub
End If
'Check to see if data is entered into the password box
If IsNull(Me.TextPassword) Or Me.TextPassword = "" Then
MsgBox "You must enter a Password.", vbOKOnly, "Required Data"
Me.TextPassword.SetFocus
Exit Sub
End If
'Check value of password in tblEmployees to see if this matches value chosen in combo box
If Me.TextPassword.Value = DLookup("Password", "AgentDetails", "[ID]=" & Me.Username.Value) Then
MyID = Me.Username.Value
'Close logon form and open splash screen
DoCmd.Close acForm, "Login Form", acSaveNo
If Me.Username.Value = Akbar Then
DoCmd.OpenForm "Akbar_Nav_Form", acPreview
ElseIf Me.Username = Badri Then
DoCmd.OpenForm "Badri_Nav_Form", acPreview
End If
MsgBox "Password Invalid. Please Try Again", vbCritical + vbOKOnly, "Invalid Entry!"
Me.TextPassword.SetFocus
End If
'If User Enters incorrect password 3 times database will shutdown
intLogonAttempts = intLogonAttempts + 1
If intLogonAttempts > 3 Then
MsgBox "You do not have access to this database. Please contact your system administrator.", vbCritical, "Restricted Access!"
Application.Quit
End If
End Sub
I am getting an run time error '2467': "The Expression you entered refers to an object that is closed or doesn't exist"
Can anyone help me out ??
Last edited by a moderator: