Hello All,
First time poster, long time reader and thank you for all the previous help I have recieved from everyone. I am having trouble conneting to my access db. I think I have the bulk if this right, but I am getting an error on the newconnection.open() line. I am not sure why, can anyone point me in the right direction??
thanks in advance
Private Sub BaleCutLogButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BaleCutLogButton.Click
Dim newconnection As New OleDb.OleDbConnection
Dim addstr As String = "INSERT INTO `ADCBaleCutterLC` (`Old Formula`, `Newe Formula`,`Raw Material Name`,`Raw Material Number`,`Batch Number`,`Performed By`,`Preformed by Date`,`Verified By`,`Verified By Date`) VALUES (add1, add2, add3, add4, add5, add6, add7, add8, add9)"
Dim addnewcommand As New OleDb.OleDbCommand
addnewcommand.Connection = newconnection
addnewcommand.CommandText = addstr
addnewcommand.Parameters.AddWithValue("add1", OldFormulaTextBox.Text)
addnewcommand.Parameters.AddWithValue("add2", NewFormulaTextBox.Text)
addnewcommand.Parameters.AddWithValue("add3", TextBox1.Text)
addnewcommand.Parameters.AddWithValue("add4", TextBox2.Text)
addnewcommand.Parameters.AddWithValue("add5", TextBox3.Text)
addnewcommand.Parameters.AddWithValue("add6", TextBox4.Text)
addnewcommand.Parameters.AddWithValue("add7", TextBox5.Text)
addnewcommand.Parameters.AddWithValue("add8", TextBox6.Text)
addnewcommand.Parameters.AddWithValue("add9", TextBox7.Text)
newconnection.Open()
addnewcommand.ExecuteNonQuery()
newconnection.Close()
MsgBox("Account Created Successful")
'modandreg.Show()
Me.Close()
End Sub
End Class