This string Variable is created by concatenating the value of a combo box and the results of a multi-select list. They could contain several other addition filters but it is like this for simplicity.
The variable is strWhere
returns this:
returns this
If I manually replace the strWhere with the outfrom the Debug.Print strWhere and paste it in a sql Statement of a querydef it works perfectly.
Can someone tell me what I am doing wrong please?
Thanks
The variable is strWhere
Code:
debug.print strWhere
Code:
([lrStandardSpecificationID] = 147) AND lrLabResultStatusID IN (4,3)
Code:
Dim Q As QueryDef, DB As Database
Set DB = CurrentDb()
Set Q = DB.QueryDefs("qryLaboratoryRecordListExcel")
Q.SQL = "Select * From qryLaboratoryRecordList Where strWhere "
Debug.Print Q.SQL
Code:
Select * From qryLaboratoryRecordList Where strWhere
If I manually replace the strWhere with the outfrom the Debug.Print strWhere and paste it in a sql Statement of a querydef it works perfectly.
Can someone tell me what I am doing wrong please?
Thanks