Private Sub Connexion_Click()
Me.Requery
Dim sql As String
Dim rs As DAO.Recordset
Static i As Byte
sql = "SELECT * FROM T_Utilisateurs WHERE Login = '" & Me.TextLogin & "' AND Password ='" & Me.TextPassword & "';"
Debug.Print sql
Set rs = CurrentDb.OpenRecordset(sql)
If Not rs.EOF Then
DoCmd.OpenForm "F_Accueil", acNormal, , , , acWindowNormal
DoCmd.Close acForm, "F_Login"
Else
MsgBox "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és", vbCritical
DoCmd.Quit
End If
End Sub