listed below is the code i have written that is not working any help would
be great if you can show me where i went wrong as i am new to this side.
thanks in advance.
Private Sub cmdlogin_Click( )
'Check to see if data is entered into the UserName combo box
If IsNull(Me.cbous ername) Or Me.cbousername = "" Then
MsgBox "You must enter a User Name.", vbOKOnly, "Required Data"
Me.cbousername. SetFocus
Exit Sub
End If
'Check to see if data is entered into the password box
If IsNull(Me.txtpa ssword) 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 usyspassword to see if this
'matches value chosen in combo box
If Me.txtpassword. Value = DLookup("Passwo rd", "usyspasswo rd", "[ID]=" &
Me.cbousername. Value) Then
ID = Me.cbousername. Value
'Close logon form and open splash screen
If Me.cbousername. Value = "admin" Then
DoCmd.Close
DoCmd.OpenForm "pers", acNormal, , "[group] = 1"
ElseIf passwd = "b" Then
DoCmd.Close
DoCmd.OpenForm "pers", acNormal, , "[group] = 2"
ElseIf passwd = "c" Then
DoCmd.Close
DoCmd.OpenForm "pers", acNormal, , "[group] = 3"
Else
DoCmd.Close
DoCmd.OpenForm "pers", acNormal, , "[group] = 4"
End If
Else
MsgBox "Password Invalid. Please Try Again", vbOKOnly, "Invalid Entry!"
Me.txtpassword. SetFocus
End If
'If User Enters incorrect password 3 times database will shutdown
intLogonAttempt s = intLogonAttempt s + 1
If intLogonAttempt s > 3 Then
MsgBox "You do not have access to this database.Please contact admin.",
vbCritical, "Restricted Access!"
Application.Qui t
End If
Exit_cmdlogin_C lick:
Exit Sub
End Sub
be great if you can show me where i went wrong as i am new to this side.
thanks in advance.
Private Sub cmdlogin_Click( )
'Check to see if data is entered into the UserName combo box
If IsNull(Me.cbous ername) Or Me.cbousername = "" Then
MsgBox "You must enter a User Name.", vbOKOnly, "Required Data"
Me.cbousername. SetFocus
Exit Sub
End If
'Check to see if data is entered into the password box
If IsNull(Me.txtpa ssword) 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 usyspassword to see if this
'matches value chosen in combo box
If Me.txtpassword. Value = DLookup("Passwo rd", "usyspasswo rd", "[ID]=" &
Me.cbousername. Value) Then
ID = Me.cbousername. Value
'Close logon form and open splash screen
If Me.cbousername. Value = "admin" Then
DoCmd.Close
DoCmd.OpenForm "pers", acNormal, , "[group] = 1"
ElseIf passwd = "b" Then
DoCmd.Close
DoCmd.OpenForm "pers", acNormal, , "[group] = 2"
ElseIf passwd = "c" Then
DoCmd.Close
DoCmd.OpenForm "pers", acNormal, , "[group] = 3"
Else
DoCmd.Close
DoCmd.OpenForm "pers", acNormal, , "[group] = 4"
End If
Else
MsgBox "Password Invalid. Please Try Again", vbOKOnly, "Invalid Entry!"
Me.txtpassword. SetFocus
End If
'If User Enters incorrect password 3 times database will shutdown
intLogonAttempt s = intLogonAttempt s + 1
If intLogonAttempt s > 3 Then
MsgBox "You do not have access to this database.Please contact admin.",
vbCritical, "Restricted Access!"
Application.Qui t
End If
Exit_cmdlogin_C lick:
Exit Sub
End Sub
Comment