How get text of a query in VB ?

M

mscertified

I have a complex query that includes in the WHERE clause a NOT IN (n1,n2)
clause.
I need to run this query but with the 'NOT IN' replaced by 'IN'.
So, I'd like to grab the text of the query and do a REPLACE, then execute
it. How would I do this? Thanks.
 
O

Ofer Cohen

Try something like

Application.CurrentDb.QueryDefs("QueryName").SQL =
Replace(Application.CurrentDb.QueryDefs("QueryName").SQL, "Not In", "In")
 
Top