Question : Save data to access dbase with VB6 tool

Hello all,

I need your help to save data from textbox and labels to get saved in an access db.
Everytime that i will click on Save button, it will save all txt box and labels on a new line in a table.
How can i do this please?

This is the code where i put the data in textbox and labels:

If Des_prod.Text <> "" Then
Dim sSQL1 As String
 Dim oRST1 As ADODB.Recordset
  Set oRST1 = New ADODB.Recordset
    Dim oConnect1 As ADODB.Connection
  Set oConnect1 = New ADODB.Connection

sSQL1 = "SELECT [Produits], [Tube], [Bouchon], [Oring], [Opération 1], [Opération 2], [Opération 3]  FROM [Description produit]"
oConnect1.Open "Provider=Microsoft.ACE.OLEDB.12.0;" & _
"Data Source=" & Form4.txtBaseDe.Text & ";"

oRST1.Open sSQL1, oConnect1

If Des_prod > "" Then
     oRST1.Filter = "Produits = '" & Des_prod.Text & "'"
        Set txtComposante1.DataSource = oRST1
        txtComposante1.DataField = "Tube"
          Set txtComposante2.DataSource = oRST1
        txtComposante2.DataField = "Bouchon"
          Set txtComposante3.DataSource = oRST1
        txtComposante3.DataField = "Oring"
               Set lblOring.DataSource = oRST1
        lblOring.DataField = "Opération 1"
                  Set lblVissé.DataSource = oRST1
        lblVissé.DataField = "Opération 2"
                  Set lblStérille.DataSource = oRST1
        lblStérille.DataField = "Opération 3"
    End If
    End If

It needs to be save in another table called: "Inventaire".

So for example,  txtComposante1 data will go in column 2 of table "Inventaire", txtComposante2 will go in column 3.......

Thanks for your help.

Answer : Save data to access dbase with VB6 tool

Hi, Wilder1626.

I believe that "Date" is a reserved word.  The syntax looks fine except for the way you're trying to insert the contents of the text field.  The line should read

SQL = "INSERT INTO Inventaire (Date) VALUES ('" & txtComposante1.Text & "')"
Random Solutions  
programming4us programming4us