CreateQueryDef - to build the base query without affecting subqueries

  • Thread starter Thread starter Santiago Gomez
  • Start date Start date
S

Santiago Gomez

I have one base query that retrieve all the records I needs, and about 6
subqueries that perform subtotal calculations and unions, etc.

I would like to create that base query dynamically from vba code (to include
WHERE clauses).

If I delete and recreate the base query programatically, will all the other
subqueries be affected?

I tested this and it looks like they are not affected, they retain the link
to the base query even if it is deleted and recreated, but just in case,
does anyone know if this can cause a problem down the line?

thanks
 
I believe queries are a runtime event. A view. Not like a table. Everytime you
run one it looks for the table or query it is run off of. Even if it errors
with a missing table. You could run it agian and it would work if the table
exists, and has the fields your pulling, etc. A table is permanent. A query is
a view of the table that is just code until you run it.
(e-mail address removed)
 
Back
Top