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 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
| Public req1, reponce, reponce1, req, str As String
Public ENTIER As Integer
Private Sub Command1_Click()
Me.Hide
End Sub
Private Sub Command2_Click()
reponce = ""
reponce1 = ""
ENTIER = Val(matricule.Text)
If ENTIER = 0 Then
MsgBox "Matricule est de type entier"
matricule.Text = ""
Else
If matricule.Text = "" Or nom.Text = "" Or prenom.Text = "" Or login.Text = "" Or motdepasse.Text = "" Then
MsgBox "Remplir les cases vides"
Else
req1 = "select matricule from user where matricule= '" & matricule.Text & "' "
With Record
.ActiveConnection = Conn
.Source = req1
.Open
End With
While Not Record.EOF
' List1Douilles.AddItem CADRecord(1).Value & " / " & CADRecord(2).Value
reponce = Record(0).Value
Record.MoveNext
Wend
Record.Close
req1 = "select login from user where login= '" & login.Text & "' "
With Record
.ActiveConnection = Conn
.Source = req1
.Open
End With
While Not Record.EOF
' List1Douilles.AddItem CADRecord(1).Value & " / " & CADRecord(2).Value
reponce1 = Record(0).Value
Record.MoveNext
Wend
Record.Close
If reponce = "" And reponce1 = "" Then
req = "insert into user(matricule,nom,prenom,login,motpass,profil,service) values ('" & matricule.Text & "','" & nom.Text & "','" & prenom.Text & "','" & login.Text & "' ,'" & motdepasse.Text & "','" & service.Text & "','" & profil.Text & "')"
With Record
.ActiveConnection = Conn
.Source = req
.Open
End With
Ajout_utulisateur.Visible = False
a = MsgBox(" Utilisateur ajouter avec succée!!", vbOKCancel, "Confirmation")
If (a = vbOK) Then
Menu_Principale.Visible = True
Else: Ajout_utulisateur.Show
End If
Else
MsgBox "Utilisateur existe"
End If
matricule.Text = ""
nom.Text = ""
prenom.Text = ""
login.Text = ""
motdepasse.Text = ""
End If
End If
End Sub |
Partager