What is the erro mesage?
Quote:
Originally Posted by rai.unmesh
Hi,
I have below SQL query which executes when run as a query; but when same is run using DoCmd.RunSQl it gives error.
DoCmd.RunSQL "INSERT INTO Test" & _
"SELECT ClashReport250815.[#ITEM_HIERARCHY_A#] AS [#ITEM_HIERARCHY_A#], ClashReport250815.[#CLASH_ID#] AS [#CLASH_ID#]" & _
"FROM LINE_ID, ClashReport250815" & _
"WHERE ((("" & ClashReport250815.[#ITEM_HIERARCHY_A#] & "") Like " * " & LINE_ID.Field1 & " * "))"
Please suggest the correct syntax.
|
The first issue that I spotted was that you need an extra space at the beginning the continuation lines after the quotes.
Code:
"FROM LINE_ID, ClashReport250815" & _
to
Code:
" FROM LINE_ID, ClashReport250815" & _
Code:
"WHERE ((("" & ClashReport250815.[#ITEM_HIERARCHY_A#] & "") Like " * " & LINE_ID.Field1 & " * "))"
to
Code:
" WHERE ((("" & ClashReport250815.[#ITEM_HIERARCHY_A#] & "") Like " * " & LINE_ID.Field1 & " * "))"