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
| Private Sub Commande0_Click()
Me.Requery
Dim sql, User_id, User_groupe, admin, users As String
Dim rs As DAO.Recordset
Static i As Byte
sql = "SELECT * FROM T_USERS WHERE TRIGRAMME ='" & Me.txt_user & "' AND PASWD ='" & Me.txt_pass & "'"
Set rs = CurrentDb.OpenRecordset(sql)
If Not rs.EOF Then
'If ("GROUPE" = admin) Then
DoCmd.OpenForm "Menu", acNormal, , , , acWindowNormal
DoCmd.Close acForm, "F_CONNEXION"
'If("GROUPE" = users) then
DoCmd.OpenForm "fEncoSorties", acNormal, , , , acWindowNormal
DoCmd.Close acForm, "F_CONNEXION"
'Endif
User_id = rs("TRIGRAMME").Value
User_groupe = rs("GROUPE").Value
Else
Me.tenta.Value = Me.tenta.Value - 1
MsgBox "(Identifiant, Mot de Passe) incorrect ", vbInformation, "Connexion"
i = i + 1
End If
If i = 3 Then
MsgBox "Vous avez dépassé le nombre de tentatives autorisées", vbCritical
DoCmd.Quit
End If
End Sub
Private Sub Form_Open(Cancel As Integer)
Me.tenta.Value = 3
End Sub |
Partager