1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| Private Sub Commande22_Click()
Dim stockConso As DAO.Database
Dim db As Database
' Dim req1 As DAO.Recordset
Set db = CurrentDb()
Dim idDuLieu As Integer
Dim idDeLaCartouche As Long
db.Execute "INSERT INTO Cartouche([Reference],[Designation],[PrixUnitaire],[QuantitéEnStock]) VALUES ('" & Texte7.Value & "','" & Modifiable9.Value & "','" & Texte13.Value & "','" & Modifiable11.Value & "')"
If Modifiable23.Value = "Oui" Then
idDuLieu = "SELECT idLieu FROM Lieu WHERE NomLieu = Modifiable25.Value"
idDeLaCartouche = "SELECT idCartouche FROM Cartouche WHERE Reference = Texte7.Value"
db.Execute "INSERT INTO Imprimante ([idCartouche],[Marque],[Reference],[idLieu]) VALUES ('" & idDeLaCartouche & "','" & Texte5.Value & "','" & Texte7.Value & "','" & idDuLieu & "')"
Else
idDeLaCartouche = "SELECT Cartouche.idCartouche FROM Cartouche WHERE Cartouche.Reference ='" & Me.Texte7 & "'"
db.Execute "INSERT INTO Lieu ([NomLieu]) VALUES ('" & Texte20.Value & "')"
idDuLieu = "SELECT idLieu FROM Lieu WHERE NomLieu = Texte20.Value"
db.Execute "INSERT INTO Imprimante ([idCartouche],[Marque],[Reference],[idLieu]) VALUES ('" & idDeLaCartouche & "','" & Texte5.Value & "','" & Texte7.Value & "','" & idDuLieu & "')"
End If
MsgBox ("L'ajout a été pris en compte")
End Sub |
Partager