Hi,
I have already created a login form and the code which i m using for it shown below.
i want to add two more steps in here and i need help now.
i want to create a Password complexity and want my program to check whether it match complexity like password should be compose of at least one Upper case letter and it should be 8 Character long with with one digit.
Also i would like the program to check that if user enter wrong password more than 12 times, then it should lock the user until it has been resumed by background user.
Here is the code that i m using
Code:
Private Sub cmdlogin_Click()
Dim rs As Recordset
Dim stDocName As String
Set rs = CurrentDb.OpenRecordset("Query1", dbOpenSnapshot, dbReadOnly)
rs.FindFirst "username = '" & Me.txtusername & "'"
If rs.NoMatch = True Then
Me.lblwrongusername.Visible = True
Me.txtusername.SetFocus
Exit Sub
End If
Me.lblwrongusername.Visible = False
TempVars("username").Value = Me.txtusername.Value
If rs!Password <> (Me.txtpassword) Then
Me.lblwrongpassword.Visible = True
Me.txtpassword.SetFocus
Exit Sub
End If
Me.lblwrongpassword.Visible = False
If Me.txtpassword = "Password1" Then
MsgBox "This is the first time using the database or your passowrd has been reset.You must change your password before you can enter the database.", vbOKOnly + vbExclamation
DoCmd.OpenForm "frmpswdchange"
Else
TempVars("username").Value = Me.txtusername.Value
If rs![Acess type] = 1 Then
DoCmd.OpenForm "frmhomeadmin"
'DoCmd.close acForm, Me.Name
Me.Visible = False
End If
If rs![Acess type] = 2 Then
DoCmd.OpenForm "frmHomePROD"
' DoCmd.close acForm, Me.Name
Me.Visible = False
End If
If rs![Acess type] = 3 Then
DoCmd.OpenForm "frmHomeQA/QC"
' DoCmd.close acForm, Me.Name
Me.Visible = False
End If
If rs![Acess type] = 4 Then
DoCmd.OpenForm "frmHomeHR"
' DoCmd.close acForm, Me.Name
Me.Visible = False
End If
If rs![Acess type] = 5 Then
DoCmd.OpenForm "frmHomePRODadmin"
' DoCmd.close acForm, Me.Name
Me.Visible = False
End If
If rs![Acess type] = 6 Then
DoCmd.OpenForm "frmHomeQA/QCadmin"
' DoCmd.close acForm, Me.Name
Me.Visible = False
End If
If rs![Days] = 55 Then
MsgBox (" Your Password will Expire in 5 days"), vbCritical + vbOKOnly, " Warning Password Expiring."
End If
If rs![Days] = 56 Then
MsgBox (" Your Password will Expire in 4 days"), vbCritical + vbOKOnly, " Warning Password Expiring."
End If
If rs![Days] = 57 Then
MsgBox (" Your Password will Expire in 3 days"), vbCritical + vbOKOnly, " Warning Password Expiring."
End If
If rs![Days] = 58 Then
MsgBox (" Your Password will Expire in 2 days"), vbCritical + vbOKOnly, " Warning Password Expiring."
End If
If rs![Days] = 59 Then
MsgBox (" Your Password will Expire in 1 days"), vbCritical + vbOKOnly, " Warning Password Expiring."
End If
If rs![Days] >= 60 Then
MsgBox (" your Password has expired.Please Contact Admin"), vbCritical + vbOKOnly, "Password Expired."
DoCmd.Quit
End If
activity.loggin "Logon"
End If
End Sub