"How can I modify the SQL via code?"
Use the SQLBuilder class. See the DADE | SQLBuilder topic for a list of How To's.
Viewing Details: