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
| If txtmatch.Text = "" Or txtplact.Text = "" Or txtpladem.Text = "" Or IsDate(txtdepo.Text) = False Then
x = MsgBox("Vous devez vérifier les champs", vbInformation, "Hotline Technique")
Exit Sub
End If
If txtmatch.Text <> "" And txtplact.Text <> "" And txtpladem.Text <> "" And txtdepo.Text <> "" Then
Dim usex As Boolean
usex = False
Call maconnexion
rs.ActiveConnection = c
rs.Open "select MATPLA,ACTUEL,DEMANDE,DATE_DEPOT from PLANNING"
Do While Not rs.EOF
If rs.Fields(0).Value = txtmatch.Text And rs.Fields(1).Value = txtplact.Text And rs.Fields(2).Value = txtpladem.Text And rs.Fields(3).Value = txtdepo.Text Then
usex = True
End If
rs.MoveNext
Loop
If usex = True Then
x = MsgBox("Cet enregistrement existe déjà", vbInformation)
Else
c.Execute " insert into PLANNING values ('" & txtmatch.Text & "' ,'" & txtnomch.Text & "','" & txtplact.Text & "','" & txtpladem.Text & "','" & txtdepo.Text & "','" & txtsem.Text & "','" & txtcau.Text & "')"
c.Execute "commit"
x = MsgBox("sauvegarde effectué ", vbInformation)
End If
End If |
Partager