PDA

Click to See Complete Forum and Search --> : Sql...INSERT QUERY (not inserting...)


Dr_Evil
Jun 13th, 2000, 08:08 PM
I am attempting to write an insert query but can't find any good references. It's saying I have a syntax error in the INSERT statement but I'm not seeing it. If someone could take a look at this or let me know of any decent examples or references. Thanks in advance...
"INSERT INTO `Rotap` (`Sample Number`, `Sample Weight`, `Sieve1`, `Sieve2`, `Sieve3`, `Sieve4`, `Sieve5`," & _
"`ON1`, `ON2`, `ON3`, `ON4`, `ON5`, `THRU1`, `THRU2`, `THRU3`, `THRU4`, `THRU5`, `Bottom`,`Tested By`, `Date Tested`" & _
"VALUES '" & txtSN.Text & "', '" & txtSW.Text & "', '" & cbo1.Text & "', '" & cbo2.Text & "', '" & cbo3.Text & "'," & _
"'" & cbo4.Text & "', '" & cbo5.Text & "', '" & txt1ON.Text & "', '" & txt2ON.Text & "', '" & txt3ON.Text & "'," & _
"'" & txt4ON.Text & "', '" & txt5ON.Text & "', '" & txt1THRU.Text & "', '" & txt2THRU.Text & "', '" & txt3THRU.Text & "'," & _
"'" & txt4THRU.Text & "', '" & txt5THRU.Text & "', '" & txtBP.Text & "', '" & txtTestedBy1.Text & "', '" & txtDateTested.Text & "'"

Negative0
Jun 13th, 2000, 08:26 PM
"INSERT INTO Rotap ([Sample Number], [Sample Weight], Sieve1, Sieve2, Sieve3, Sieve4, Sieve5," & _
"ON1, ON2, ON3, ON4, ON5, THRU1, THRU2, THRU3, THRU4, THRU5, Bottom,[Tested By], [Date Tested])" & _
"VALUES ('" & txtSN.Text & "', '" & txtSW.Text & "', '" & cbo1.Text & "', '" & cbo2.Text & "', '" & cbo3.Text & "'," & _
"'" & cbo4.Text & "', '" & cbo5.Text & "', '" & txt1ON.Text & "', '" & txt2ON.Text & "', '" & txt3ON.Text & "'," & _
"'" & txt4ON.Text & "', '" & txt5ON.Text & "', '" & txt1THRU.Text & "', '" & txt2THRU.Text & "', '" & txt3THRU.Text & "'," & _
"'" & txt4THRU.Text & "', '" & txt5THRU.Text & "', '" & txtBP.Text & "', '" & txtTestedBy1.Text & "', '" & txtDateTested.Text & "')"

A generic INSERT statement looks like

INSERT into tblName (field1,field2) VALUES('" & text1.text & "','" & text2.text & "'"

Hope this helps