Hi Nadya,
when I have had to deal with this in the past, I would break my macro down into mutiple macros based on clause. For example macro substitute your WHERE clause, your FROM clause, and your HAVING clause. HTH.
Roxanne M. Seibert
Independent Consultant, VFP MCP
Code Monkey Like Fritos