hi all

I have two tables and the form contains a text box so I need to add rows of Table 1 to Table 2 and taking the value in the text box for each row is added to Table 2.

i have insert syntax but it is need to modification:

INSERT INTO table2(column3) SELECT column1 @parameter FROM table1 WHERE column2=true

table1: column1 column2

table2: column3

Form1: it have textbox1

the full code :


Code:
  Dim con As New OleDbConnection
    Dim cmd As New OleDbCommand
    Try
        con.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\DellXPS\Desktop\mDB.accdb"

        con.Open()
        cmd.Connection = con
        cmd.CommandText = "INSERT INTO table2(column3) SELECT column1 @parameter FROM table1 WHERE column2=true"
        
        cmd.Parameters.Add("@parameter",  OleDbType.VarChar).Value = TextBox1.Text
        cmd.ExecuteNonQuery()
    Catch ex As Exception
        MessageBox.Show("Error while inserting record on table..." & ex.Message, "Insert Records")
    Finally
        con.Close()
    End Try
i think the wrong in insert syntax ,, hop to corrected