I am setting a list box row source conditionally based on a value:
If MyValue = "" then
Me.MyList.RowSource = "SELECT...
FROM...
RIGHT JOIN...
GROUP BY...
ORDER BY...
Else
Me.MyList.RowSource = "SELECT...
FROM...
RIGHT JOIN...
GROUP BY...
HAVING MyValue
ORDER BY...
End if
Where MyValue is some criteria for the HAVING part. This works fine as long as MyValue is not "" (blank). However during compile, I get a Microsoft Access error: "Syntax error on HAVING clause." During runtime, the "else" with HAVING does not occur so no error there. How can I avoid or trap the "Syntax error on HAVING clause." during compile? The usual "On error..." does not trap during compile.
Thanks.