J
Joel
I have a combo box that is used to activate different forms after
validating username/password. However, I would like to have the combo
box recycle to a blank box when the password validation fails. I have
tried requery, refresh and setting the box to null without the correct
results. This is what I am working with.
Private Sub FormsCbo_AfterUpdate()
'Check to see if data is entered into the UserName combo box
If IsNull(Me.cboEmployee) Or Me.cboEmployee = "" Then
MsgBox "You must enter a User Name.", vbOKOnly, "Required
Data"
Me.cboEmployee.SetFocus
Exit Sub
End If
'Check to see if data is entered into the password box
If IsNull(Me.txtPassword) Or Me.txtPassword = "" Then
MsgBox "You must enter a Password.", vbOKOnly, "Required
Data"
Me.txtPassword.SetFocus
Exit Sub
End If
'Check value of password in tblEmployees to see if this matches value
chosen in combo box
If Me.txtPassword.Value = DLookup("strEmpPassword", "tblEmployees",
"[lngEmpID]=" & Me.cboEmployee.Value) Then
lngMyEmpID = Me.cboEmployee.Value
'Open Next Form based on Combo Box Selection
DoCmd.OpenForm Me.FormsCbo.Column(2)
Else
MsgBox "The Password Invalid. Please Try Again", vbOKOnly,
"Invalid Entry!"
Me.txtPassword.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 don't know why I can't figure this out (maybe just be looking at it
too long)? Any help would be appreciated.
validating username/password. However, I would like to have the combo
box recycle to a blank box when the password validation fails. I have
tried requery, refresh and setting the box to null without the correct
results. This is what I am working with.
Private Sub FormsCbo_AfterUpdate()
'Check to see if data is entered into the UserName combo box
If IsNull(Me.cboEmployee) Or Me.cboEmployee = "" Then
MsgBox "You must enter a User Name.", vbOKOnly, "Required
Data"
Me.cboEmployee.SetFocus
Exit Sub
End If
'Check to see if data is entered into the password box
If IsNull(Me.txtPassword) Or Me.txtPassword = "" Then
MsgBox "You must enter a Password.", vbOKOnly, "Required
Data"
Me.txtPassword.SetFocus
Exit Sub
End If
'Check value of password in tblEmployees to see if this matches value
chosen in combo box
If Me.txtPassword.Value = DLookup("strEmpPassword", "tblEmployees",
"[lngEmpID]=" & Me.cboEmployee.Value) Then
lngMyEmpID = Me.cboEmployee.Value
'Open Next Form based on Combo Box Selection
DoCmd.OpenForm Me.FormsCbo.Column(2)
Else
MsgBox "The Password Invalid. Please Try Again", vbOKOnly,
"Invalid Entry!"
Me.txtPassword.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 don't know why I can't figure this out (maybe just be looking at it
too long)? Any help would be appreciated.