Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Public Function Str2Sql(S As String) As String
- Str2Sql = "'" & Replace$(S, "'", "''") & "'"
- End Function
- Private Sub CmdEnregistrer_Click()
- Dim rep As VbMsgBoxResult
- If Len(CboCodeArt.Text) And Len(CboCatArt.Text) And Len(TxtLibArt.Text) And Len(TxtPu.Text) And Len(TxtUnitArt.Text) Then
- rep = MsgBox("Etes-vous sûr de vouloir enregistrer cet article?", vbYesNo, "Articles")
- If rep = vbYes Then
- Call Connexion1
- If rs.EOF = False Then
- MsgBox "Cet article existe déjà. En enregistrer un autre svp!", vbCritical, "Articles"
- Call Annul
- Exit Sub
- Else
- 'enregistrement article
- If Len(CboCodeArt.Text) > 5 Then
- MsgBox "Le code ne doit pas dépasser 5 caractères!", vbInformation, "Articles"
- Call Annul
- Exit Sub
- End If
- taConnexion.Execute "INSERT INTO taTable(codeart, refcatart, libart, puart, unitart) VALUES (" & Str2Sql(CboCodeArt.Text) & "," & _
- Str2Sql(CboCatArt.Text) & "," & Str2Sql(UCase(TxtLibArt.Text)) & "," & Str2Sql(TxtPu.Text) & "," & Str2Sql(UCase(TxtUnitArt.Text)) & ")"
- MsgBox "L'enregistrement s'est déroulé avec succès", vbInformation, "Articles"
- 'màj liste combo codeart
- CboCodeArt.Clear
- Call Connexion_Art
- Do Until rsart.EOF
- CboCodeArt.AddItem rsart!codeart
- rsart.MoveNext
- Loop
- Call Annul
- Exit Sub
- End If
- Else
- Call Annul
- Exit Sub
- End If
- Else
- MsgBox "Donnez tous les renseignements voulus svp!!!", vbCritical, "Articles"
- Call Test
- End If
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement