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
| Private Sub OK_Click()
On Error GoTo Err_OK_Click
Dim estTrouve As Boolean
Dim db As DAO.Database
Dim r As DAO.Recordset
Set db = CurrentDb
Set r = db.OpenRecordset("qry_user") 'Ceci est une requête
If r.RecordCount <> 0 Then
estTrouve = True
Else
estTrouve = False
End If
r.Close: Set r = Nothing
db.Close: Set db = Nothing
If estTrouve Then
MsgBox ("Welcome / Bienvenue"), vbOKOnly
DoCmd.Close
Else
MsgBox ("Username or password not valide / Nom d'utilisateur ou mot de passe invalide"), vbOKOnly
End If
Exit_OK_Click:
Exit Sub
Err_OK_Click:
MsgBox Err.Description
Resume Exit_OK_Click
End Sub |
Partager