Erreur code vba
Résolu
sanae
-
sanae -
sanae -
Bonjour,
j ai ecrit un code vba mais il me donne une erreur lors de l execution est ce que vous pouvvez maider a la corriger???
merci d avance
j ai ecrit un code vba mais il me donne une erreur lors de l execution est ce que vous pouvvez maider a la corriger???
merci d avance
A voir également:
- Erreur code vba
- Code ascii - Guide
- Code puk bloqué - Guide
- Code activation windows 10 - Guide
- Comment déverrouiller un téléphone quand on a oublié le code - Guide
- Code blocks - Télécharger - Langages
43 réponses
nn
makhadmatch ba9i le meme prb ma3raftch chno ndir bach yat7al l formulaire selon user
ila can user=administrateur yat7l l menu1 sinon yat7al menu
Private Sub Commande8_Click()
Static i As Byte
Dim rs As Recordset
Set db = CurrentDb
Set rs = db.OpenRecordset("SELECT [LOGIN],[PASSWORD],[USER] FROM USERS WHERE LOGIN = '" & Me.LOGIN & "' AND [PASSWORD]='" & Me.PASSWORD & "';")
If Not rs.EOF Then
If User = "administrateur" Then
stDoName = "menu1"
End If
DoCmd.OpenForm "menu1", acNormal, , , , acWindowNormal
If User = "limite" Then
DoCmd.OpenForm "menu", acNormal, , , , acWindowNormal
stDoName = "menu"
End If
DoCmd.Close acForm, "accés"
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
chouf ila banlak chi erreur
makhadmatch ba9i le meme prb ma3raftch chno ndir bach yat7al l formulaire selon user
ila can user=administrateur yat7l l menu1 sinon yat7al menu
Private Sub Commande8_Click()
Static i As Byte
Dim rs As Recordset
Set db = CurrentDb
Set rs = db.OpenRecordset("SELECT [LOGIN],[PASSWORD],[USER] FROM USERS WHERE LOGIN = '" & Me.LOGIN & "' AND [PASSWORD]='" & Me.PASSWORD & "';")
If Not rs.EOF Then
If User = "administrateur" Then
stDoName = "menu1"
End If
DoCmd.OpenForm "menu1", acNormal, , , , acWindowNormal
If User = "limite" Then
DoCmd.OpenForm "menu", acNormal, , , , acWindowNormal
stDoName = "menu"
End If
DoCmd.Close acForm, "accés"
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
chouf ila banlak chi erreur
Faire ceci:
Private Sub Commande8_Click()
Static i As Byte
Dim rs As Recordset
********Ajouter ceci*************************
Dim user AS String
***********************************
Set db = CurrentDb
Set rs = db.OpenRecordset("SELECT [LOGIN],[PASSWORD],[USER] FROM USERS WHERE LOGIN = '" & Me.LOGIN & "' AND [PASSWORD]='" & Me.PASSWORD & "';")
If Not rs.EOF Then
**************************************************
****Récupérer le user et l'afficher**************
user = rs("USER")
************Gouli lia wach hwa hadak le user ou pas******
MsgBox(user)
If User = "administrateur" Then
stDoName = "menu1"
DoCmd.OpenForm "menu1", acNormal, , , , acWindowNormal
End If
If User = "limite" Then
DoCmd.OpenForm "menu", acNormal, , , , acWindowNormal
stDoName = "menu"
DoCmd.OpenForm "menu", acNormal, , , , acWindowNormal
End If
DoCmd.Close acForm, "accés"
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
Private Sub Commande8_Click()
Static i As Byte
Dim rs As Recordset
********Ajouter ceci*************************
Dim user AS String
***********************************
Set db = CurrentDb
Set rs = db.OpenRecordset("SELECT [LOGIN],[PASSWORD],[USER] FROM USERS WHERE LOGIN = '" & Me.LOGIN & "' AND [PASSWORD]='" & Me.PASSWORD & "';")
If Not rs.EOF Then
**************************************************
****Récupérer le user et l'afficher**************
user = rs("USER")
************Gouli lia wach hwa hadak le user ou pas******
MsgBox(user)
If User = "administrateur" Then
stDoName = "menu1"
DoCmd.OpenForm "menu1", acNormal, , , , acWindowNormal
End If
If User = "limite" Then
DoCmd.OpenForm "menu", acNormal, , , , acWindowNormal
stDoName = "menu"
DoCmd.OpenForm "menu", acNormal, , , , acWindowNormal
End If
DoCmd.Close acForm, "accés"
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