What about this? I know probably a lot of errors but I'm trying
Code:
Option Compare DatabasePrivate intLoginAttempts As Integer
Private Sub Form_Open(Cancel As Integer)
Me.LogInUser.SetFocus
End Sub
Private Sub LogInButton_Click()
If IsNull(Me.LogInUser) Or Me.LogInUser = "" Then
MsgBox "You must enter a User Name.", vbOKOnly, "Required Data"
Me.LogInUser.SetFocus
Exit Sub
End If
If IsNull(Me.LogInPassword) Or Me.LogInPassword = "" Then
MsgBox "You must enter a Password.", vbOKOnly, "Required Data"
Me.LogInPassword.SetFocus
Exit Sub
End If
If Me.LogInPassword.Value = DLookup("strPass", "yp_team", "[lngEmpID]=" & Me.LogInUser.Value) Then
lngMyEmpId = Me.LogInUser.Value
DoCmd.Close acForm, "yp_lgn_dia", acSaveNo
If lngMyEmpId = DLookup("strEmpGrp", "yp_team" = crs) Then
DoCmd.OpenForm "yp_crs"
Else
If lngMyEmpId = DLookup("strEmpGrp", "yp_team" = ipm) Then
DoCmd.OpenForm "yp_ipm"
Else
If lngMyEmpId = DLookup("strEmpGrp", "yp_team" = teaml) Then
DoCmd.OpenForm "yp_teaml"
Else
If lngMyEmpId = DLookup("strEmpGrp", "yp_team" = master) Then
DoCmd.OpenForm "yp_master"
Else
MsgBox "Password Invalid. Please Try Again", vbOKOnly, "Invalid Entry!"
Me.LogInPassword.SetFocus
End If