Syntax error (comma) in query - ?????????????????????????

B

Billp

I Have the following which gives me the error

"Syntax Error (comma) in Query
'([Link_ID_PS],[Packing_Slip_REV],[Item_Code],[Description],[Qty_Packing_Slip])'

strOtherFields =
",[Packing_Slip_REV],[Item_Code],[Description],[Qty_Packing_Slip]"

strsql = "INSERT INTO [tblOtherShipped_Packing_Slip] " _
& "([Link_ID_PS]" & strOtherFields & ")" _
& " SELECT ([Link_ID_PS]" & strOtherFields & ")" _
& " FROM tblOther_Packing_Slip" _
& " WHERE [Link_ID_PS] = " & Me![PS_ID] 'field id
numeric
Debug.Print strsql

Link_ID_PS is numeric
Me![PS_ID] is numeric

The Immediate window gives me,

INSERT INTO [tblOtherShipped_Packing_Slip]
([Link_ID_PS],[Packing_Slip_REV],[Item_Code],[Description],[Qty_Packing_Slip])
SELECT
([Link_ID_PS],[Packing_Slip_REV],[Item_Code],[Description],[Qty_Packing_Slip]) FROM tblOther_Packing_Slip WHERE [Link_ID_PS] = 1


Thanks in advance
must be the weekend.

Best regards
 
T

Tom van Stiphout

On Thu, 8 Oct 2009 18:56:01 -0700, Billp

I don't think the SELECT clause should be in parentheses.

One technique you can use: copy the string from the immediate window
into a new query in SQL view. Switch to design view.

-Tom.
Microsoft Access MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top