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 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
| Private Sub Commande79_Click()
Me.Requery
Dim sql As String
Dim rs As DAO.Recordset
Dim admin
Dim stDocName As String
Dim poste As Long
Dim MyCheck
Static i As Byte
sql = "SELECT T_PERSONNEL.PERSO_LOGIN,T_PERSONNEL.PERSO_PASSW,T_PERSONNEL.PERSO_ADMIN,T_PERSONNEL.PERSO_POSTE,T_POSTE.ID_POSTE FROM T_PERSONNEL,T_POSTE WHERE T_PERSONNEL.PERSO_LOGIN = '" & Me.login & "' AND T_PERSONNEL.PERSO_PASSW ='" & Me.passwd & "';"
Set rs = CurrentDb.OpenRecordset(sql)
If Not rs.EOF Then
If rs("PERSO_ADMIN") = True Then
MsgBox "Accès administrateur autorisé ", vbInformation, "Connexion"
DoCmd.OpenForm "FRM_MENU_GENERAL ", acNormal, , , , acWindowNormal
DoCmd.Close acForm, "FRM_CONNEXION"
Else
'MsgBox "Accès en mode utilisateur autorisé ", vbInformation, "Connexion"
poste = rs("PERSO_POSTE")
If poste = Null Then
MsgBox "Pas de fiche disponible", vbInformation, "Connexion"
Else
stDocName = "POSTE"
DoCmd.OpenReport stDocName, acPreview, , "id_poste =" & poste
MsgBox poste, vbInformation, "Connexion"
'DoCmd.Close acForm, "FRM_CONNEXION"
End If
End If
Else
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és", vbCritical
DoCmd.Quit
End If
End Sub |
Partager