SmileyFace
Programmer
I have a problem trying to get this SQL statement to work. Obviously, if you see the flow, it attaches an 'OR' to the last line of the where clause and hence the SQL statement has a syntax error. How can I write it such that it still takes the 'OR' but takes the last 'OR' off?
While Not rs2.EOF
sSql3 = sSql3 & "(trim([PA_Detail].Quality) = " & rs2![QualityXRef] & " OR "
rs2.MoveNext
Wend
sSql = sSql & " AND (" & sSql3 & "
"
While Not rs2.EOF
sSql3 = sSql3 & "(trim([PA_Detail].Quality) = " & rs2![QualityXRef] & " OR "
rs2.MoveNext
Wend
sSql = sSql & " AND (" & sSql3 & "