Précédent
- 1
- 2
Ouah le foutoir la dedans, j'ai pas eu le courrage de tous lire, enfin bon, tu travail sous Access, alors prends ADO et pas DAO pour commencer, respecte aussi une nomenclature un peu plus rigoureuse. Enfin bon, voila comment j'écrirais perso ton code, mais en ADO :
Private Sub connexion_Click()
Dim strSql As String
Static i As Byte
Dim rst As Recordset
strSql = "SELECT login, mot_de_passe FROM T_User WHERE login = " & """" & Me.txt_user & """" & " AND [mot_de_passe]=" & """" & Me.txt_pass & """"
Set rst = New ADODB.Recordset
rst.Open strSql, CurrentProject.Connection, adOpenStatic, adLockReadOnly
If Not rst.EOF Then
DoCmd.OpenForm "FM_Evaluation", acNormal, , , , acWindowNormal
DoCmd.Close acForm, "F_CONNEXION"
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
Voila, si ca ne marche pas, vérifie ta requete
Private Sub connexion_Click()
Dim strSql As String
Static i As Byte
Dim rst As Recordset
strSql = "SELECT login, mot_de_passe FROM T_User WHERE login = " & """" & Me.txt_user & """" & " AND [mot_de_passe]=" & """" & Me.txt_pass & """"
Set rst = New ADODB.Recordset
rst.Open strSql, CurrentProject.Connection, adOpenStatic, adLockReadOnly
If Not rst.EOF Then
DoCmd.OpenForm "FM_Evaluation", acNormal, , , , acWindowNormal
DoCmd.Close acForm, "F_CONNEXION"
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
Voila, si ca ne marche pas, vérifie ta requete
tiens !à l'ouverture du formulaire acceuil le mt de passe est idheo.
si tu veux te balader c'est www.idheo.com
si tu veux te balader c'est www.idheo.com
Voila enfin le bon code! ça pourra aider les autres.
Dim msg As String, Titre As String, defval As String
Dim sql As String
Dim bd As Database
Dim Enreg As Recordset
Set bd = CurrentDb()
sql = "Select login, mot_de_passe From T_User Where login = " & """" & Me.txtlogin & """" & " AND mot_de_passe = " & """" & Me.txtpass & """"
'sql = "select distinctrow login,mot_de_passe from T_User "
Set Enreg = bd.OpenRecordset(sql)
If Enreg.EOF Then
MsgBox ("ereur")
Else
DoCmd.OpenForm "FM_Evaluation"
End If
End Sub
Dim msg As String, Titre As String, defval As String
Dim sql As String
Dim bd As Database
Dim Enreg As Recordset
Set bd = CurrentDb()
sql = "Select login, mot_de_passe From T_User Where login = " & """" & Me.txtlogin & """" & " AND mot_de_passe = " & """" & Me.txtpass & """"
'sql = "select distinctrow login,mot_de_passe from T_User "
Set Enreg = bd.OpenRecordset(sql)
If Enreg.EOF Then
MsgBox ("ereur")
Else
DoCmd.OpenForm "FM_Evaluation"
End If
End Sub
Précédent
- 1
- 2
merci pour ton code mais il ne ne marche pas encore
il me met une erreur quand je compile:
ici: rst.Open strSql, CurrentProject.Connection, adOpenStatic, adLockReadOnly
et c'est sur le mot "open" il met: membre de methode ou de donnée introuvable.
j'ai bien mis aussi ADO avec la plus grande priorité