Hello:
I need some assistance with tweaking my strWhere clause. Once I modified it, the 2 lines (as part of *Option #3) result in a syntax error. Here's what I have:
Option #1: Criteria for 2 fields [SOURCE_FILE] & [PRODUCT_TABLE]
Code:
strWhere = "WHERE [SOURCE_FILE] in (" & Left(strSource, Len(strSource) - 1) & ") AND [PRODUCT_TABLE] in (" & Left(strProduct, Len(strProduct) - 1) & ")"
... option #1 executes w/o any errors.
Option #2: Criteria for 2 fields [SOURCE_FILE] & [PRODUCT_TABLE] with multiple rows WHERE 'EXTRA' needs to remain hard-coded
Code:
strWhere = "WHERE ((([01_tbl_ProductTables].SOURCE_FILE) in (" & Left(strSource, Len(strSource) - 1) & ")) And (([01_tbl_ProductTables].PRODUCT_TABLE) = 'DEMOGRAPHICS')) " & _
"Or ((([01_tbl_ProductTables].SOURCE_FILE) = 'EXTRA') And (([01_tbl_ProductTables].PRODUCT_TABLE) = 'DEMOGRAPHICS'))"
... option #2 executes w/o any errors.
Option #3: Criteria for 2 fields [SOURCE_FILE] & [PRODUCT_TABLE] with multiple rows WHERE 'EXTRA' needs to remain hard-coded but 'Demographics' needs to be dynamic
Code:
strWhere = "WHERE ((([01_tbl_ProductTables].SOURCE_FILE) in (" & Left(strSource, Len(strSource) - 1) & ")) And (([01_tbl_ProductTables].PRODUCT_TABLE) in (" & Left(strProduct, Len(strProduct) - 1) & ") " & _
"Or ((([01_tbl_ProductTables].SOURCE_FILE) = 'EXTRA') And (([01_tbl_ProductTables].PRODUCT_TABLE) in (" & Left(strProduct, Len(strProduct) - 1) & ")"""
... option #3 results in syntax error upon execution. See attached JPG for details.
My question: How do I need to modify the VBA (i.e., add/remove parenthesis and/or other characters) so that option #3 code will execute?
Thank you,
Tom