Hi team - I am getting a "incorrect syntax near 'cust_id' error from the below code in VBA.
I've tried the below in SQL Server and it works, so must be an issue in VBA?
Not sure if this is more an SQL query rather than VBA issue, but any help would be great! Thanks!!
I've tried the below in SQL Server and it works, so must be an issue in VBA?
Not sure if this is more an SQL query rather than VBA issue, but any help would be great! Thanks!!
VBA Code:
SQLQry = "SELECT cust_name, cust_contact" & _
"FROM customers" & _
"WHERE cust_id IN (SELECT cust_id" & _
"FROM orders" & _
"WHERE order_num IN (SELECT order_num" & _
"FROM orderitems" & _
"WHERE prod_id = 'RGAN01'))"