I found out today that if you are going to use #quotedvaluelist()# in a query that you have to use it in the query and not set it as a variable before hand.
WHERE something NOT IN (#quotedvaluelist(query.column)#)
WHERE something NOT IN (#varname#)
The bad example escapes the single quotes once it is used in the query. Not fun.