I have a code that i use to save data in an Microsoft Access data base. Code bellow.
But now, i want to have a code that would search for the text in "txtNomDuProduit1" (Name of a product in column 2 of my access db. and it would save all modification in the same row.
How can i do this please?
Thanks again for your help.
'Insert data in Microsoft Access Data Base Dim MyConn As ADODB.Connection Dim MyRecSet1 As New ADODB.Recordset Set MyConn = New ADODB.Connection MyConn.Open "Provider=Microsoft.ACE.OLEDB.12.0;;Data Source=" & Form4.txtBaseDe.Text MyRecSet1.Open "SELECT * FROM [Description produit] WHERE Produits='" & txtNomDuProduit1.Text & "'", MyConn, adOpenForwardOnly, adLockReadOnly If MyRecSet1.EOF Then MyRecSet1.close Set MyRecSet1 = MyConn.Execute( _ "INSERT INTO [Description produit] (Produits, Tube, Bouchon, Oring, Coût_unitaire, Par_tranche_de, Opération_1, Opération_2, Opération_3, Nombre_étape ) VALUES ( '" & _ txtNomDuProduit1.Text & _ "' , '" & txtTube1.Text & "' , '" & txtBouchon1.Text & "' ,'" & txtOring1.Text & "' ,'" & txtCout_unitaire.Text & "' ,'" & txtParTranche.Text & "' , '" & ComOpération1.Text & _ "' , '" & ComOpération2.Text & "' ,'" & ComOpération3.Text & _ "' , '" & ComNombreD.Text & "' )") MsgBox "Vos nouvelles quantités ont été enregistrées." ', vbCritical, "Succesful adding"
MyConn.Execute( _
"UPDATE [Description produit] SET " & _
" Produits = '" & txtNomDuProduit1.Text & "', " & _
" Tube = '" & txtNomDuProduit1.Text & "', " & _
" ... " & _
" where ProductID = " & YOURID_HERE