SQL Statement

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Can someone please tell me whats wrong with this SQL statement.

I'm trying to append some records from one table to another using the ITM_CD
equals certain records selected from a list box.

stSQL = "INSERT INTO [WO#1] ( ITM_CD, BID_QTY, UNT_PRIC, QTY_INSTL_TO_DT,
QTY_PD_TO_DT, DESC1, UNT_T )" & _
" SELECT Master_Items_T.ITM_CD, Master_Items_T.BID_QTY,
Master_Items_T.UNT_PRIC, " & _
" Master_Items_T.QTY_INSTL_TO_DT, Master_Items_T.QTY_PD_TO_DT,
Master_Items_T.DESC1," & _
" Master_Items_T.UNT_T FROM Master_Items_T WHERE , " & _
"((Master_Items_T.ITM_CD)=""0102 1"");"
 
What is the problem? Do you get an error?

On the SQL why do you have (,) after the Where

And try and change the last line to
"((Master_Items_T.ITM_CD)='0102 1');"
 
There should be no comma after the keyword "WHERE"
" Master_Items_T.UNT_T FROM Master_Items_T WHERE , " & _ <---- this
comma shouldn't be here

--
Brendan Reynolds

Mike Johnson said:
Can someone please tell me whats wrong with this SQL statement.

I'm trying to append some records from one table to another using the
ITM_CD
equals certain records selected from a list box.

stSQL = "INSERT INTO [WO#1] ( ITM_CD, BID_QTY, UNT_PRIC, QTY_INSTL_TO_DT,
QTY_PD_TO_DT, DESC1, UNT_T )" & _
" SELECT Master_Items_T.ITM_CD, Master_Items_T.BID_QTY,
Master_Items_T.UNT_PRIC, " & _
" Master_Items_T.QTY_INSTL_TO_DT, Master_Items_T.QTY_PD_TO_DT,
Master_Items_T.DESC1," & _
" Master_Items_T.UNT_T FROM Master_Items_T WHERE , " & _
"((Master_Items_T.ITM_CD)=""0102 1"");"
 
Thanks Guys, I did not notice the comma and the other suggestion worked
great. Again thanks.

Brendan Reynolds said:
There should be no comma after the keyword "WHERE"
" Master_Items_T.UNT_T FROM Master_Items_T WHERE , " & _ <---- this
comma shouldn't be here

--
Brendan Reynolds

Mike Johnson said:
Can someone please tell me whats wrong with this SQL statement.

I'm trying to append some records from one table to another using the
ITM_CD
equals certain records selected from a list box.

stSQL = "INSERT INTO [WO#1] ( ITM_CD, BID_QTY, UNT_PRIC, QTY_INSTL_TO_DT,
QTY_PD_TO_DT, DESC1, UNT_T )" & _
" SELECT Master_Items_T.ITM_CD, Master_Items_T.BID_QTY,
Master_Items_T.UNT_PRIC, " & _
" Master_Items_T.QTY_INSTL_TO_DT, Master_Items_T.QTY_PD_TO_DT,
Master_Items_T.DESC1," & _
" Master_Items_T.UNT_T FROM Master_Items_T WHERE , " & _
"((Master_Items_T.ITM_CD)=""0102 1"");"
 
Back
Top