1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
| Private Sub Commande1_Click()
Dim UserLevel As Integer
Dim TempPass As String
Dim ID As Integer
If IsNull(Me.txtLoginID) Then
MsgBox "entrez un Login", vbInformation, "Login nécessaire"
Me.txtLoginID.SetFocus
ElseIf IsNull(Me.txtPassword) Then
MsgBox "entrez un Mot de passe", vbInformation, "Mot de passe nécessaire"
Me.txtPassword.SetFocus
Else
'Mise en route
If (IsNull(DLookup("UserLogin", "TblUser", "UserLogin ='" & Me.txtLoginID.Value & "'"))) Or _
(IsNull(DLookup("Password", "TblUser", "Password ='" & Me.txtPassword.Value & "'"))) Then
MsgBox "Login ou Mot de passe incorrect"
Else
UserLevel = DLookup("UserSecurity", "TblUser", "UserLogin ='" & Me.txtLoginID.Value & "'")
TempPass = DLookup("password", "TblUser", "UserLogin = '" & Me.txtLoginID.Value & "'")
ID = DLookup("UserID", "TblUser", "UserLogin = '" & MeTxtLoginID.Value & "'")
DoCmd.Close
If (TempPass = "Password") Then
MsgBox "Merci de changer de Mot de passe", vbInformation, "Nouveau Mot de passe nécessaire"
DoCmd.OpenForm "UserInfo", , , "[UserID] = & ID"
Else
If UserLevel = 1 Then
'MsgBox "Login et Mot de passe corrects"
DoCmd.OpenForm "Menu Principal"
Else
DoCmd.OpenForm "Utilisateurs"
End If
End If
End If
End If
End Sub |
Partager