Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Insert SQL Statement in VB 2

Status
Not open for further replies.

FJAY

Programmer
Apr 23, 2003
106
CA
strSQLUpdate = "INSERT INTO DEMAND_SUPPLY_LINK " _
"(ID, DEMAND_TYPE, DEMAND_BASE_ID, DEMAND_SEQ_NO, _
SUPPLY_TYPE, SUPPLY_BASE_ID, SUPPLY_SUB_ID, _
DEMAND_PART_ID, SUPPLY_PART_ID, ALLOCATED_QTY, _
RECEIVED_QTY, ISSUED_QTY, SUPPLY_MODE, _
CREATE_DATE, USER_ID)"

Values('','')

My problem is that I have numerous columns (32) and I will like it to continue on the next line. This applies also to the Values. I'm having some problems with the insert statement. thanks.
 


try this
strSQLUpdate="INSERT INTO DEMAND_SUPPLY_LINK " & _
"(ID, DEMAND_TYPE,DEMAND_BASE_ID,DEMAND_SEQ_NO, " & _
"SUPPLY.......get the idea"

you cannot just put a _ to continue a line (at least not in this case)

YOUR CODE---

strSQLUpdate = "INSERT INTO DEMAND_SUPPLY_LINK " _
"(ID, DEMAND_TYPE, DEMAND_BASE_ID, DEMAND_SEQ_NO, _
SUPPLY_TYPE, SUPPLY_BASE_ID, SUPPLY_SUB_ID, _
DEMAND_PART_ID, SUPPLY_PART_ID, ALLOCATED_QTY, _
RECEIVED_QTY, ISSUED_QTY, SUPPLY_MODE, _
CREATE_DATE, USER_ID)"
 
I did exactly that but am having some problems with value part of the statement. Look below:

strSQLInsert = "INSERT INTO DEMAND_SUPPLY_LINK " & _
"(ID, DEMAND_TYPE, DEMAND_BASE_ID, DEMAND_SEQ_NO, SUPPLY_TYPE, SUPPLY_BASE_ID," & _
"SUPPLY_SUB_ID, DEMAND_PART_ID, SUPPLY_PART_ID, ALLOCATED_QTY, RECEIVED_QTY," & _
"ISSUED_QTY, SUPPLY_MODE, CREATE_DATE, USER_ID)" & _
"Values('" & frmCust.txtDemand(0).Text & "', 'CO' " & _
" '" & frmCust.txtDemand(1).Text & "', " & _
" '" & frmCust.txtDemand(2).Text & "', 'I' " & _
" '" & frmCust.txtDemand(3).Text & "', '0' " & _
" '" & frmCust.txtDemand(4).Text & "', " & _
" '" & frmCust.txtDemand(5).Text & "', " & _
" '" & frmCust.txtDemand(6).Text & "', " & _
" '" & frmCust.txtDemand(7).Text & "', '0', 'A', " & _
" '" & strDate & "', 'ALLOC')"

incorrect syntax near frmcust.txtdemand(1).text
 
"Values('" & frmCust.txtDemand(0).Text & "', 'CO', " & _
 
your forgetting a comma and a space

strSQLInsert = "INSERT INTO DEMAND_SUPPLY_LINK " & _
"(ID, DEMAND_TYPE, DEMAND_BASE_ID, DEMAND_SEQ_NO, SUPPLY_TYPE, SUPPLY_BASE_ID," & _
"SUPPLY_SUB_ID, DEMAND_PART_ID, SUPPLY_PART_ID, ALLOCATED_QTY, RECEIVED_QTY," & _
"ISSUED_QTY, SUPPLY_MODE, CREATE_DATE, USER_ID) " & _
"Values('" & frmCust.txtDemand(0).Text & "', 'CO', " & _
" '" & frmCust.txtDemand(1).Text & "', " & _
" '" & frmCust.txtDemand(2).Text & "', 'I' " & _
" '" & frmCust.txtDemand(3).Text & "', '0' " & _
" '" & frmCust.txtDemand(4).Text & "', " & _
" '" & frmCust.txtDemand(5).Text & "', " & _
" '" & frmCust.txtDemand(6).Text & "', " & _
" '" & frmCust.txtDemand(7).Text & "', '0', 'A', " & _
" '" & strDate & "', 'ALLOC')"
 
Thank you very much...............)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top