programitically changing query

Help.Chris

Registered User.
Local time
Today, 23:49
Joined
Oct 11, 2000
Messages
43
Hi everyone,

I need to change a query at run time in a form. In one condition it will have less tables, so will need to seperate queries.

Can you change the queries sql at run time, whilst keeping the same query name.
The query will then be used at the foundation of a complex report.
I do not want 2 separate queries if I can help it, as it will cause duplication of all other queries, over 15 so far.

Any help would be greatly appreciated.

Thanks

Chris
 
Hi,
If you use a SQL pass-through query, you can write as much (or as little) of your query in code as you like. This is extremely flexible, but requires some VBA skills. I usually store the query front-ends as separate queries (qCFY_Front_End, qMTD_Front_End, qPFY_Front_End...) so this method does not necessarily reduce the number of queries in an .mdb. Yes, you could write it all in code, but then you need to muck through the code to make even small changes (vs. changing the relatively simpler SQL.)

That said, 15 is not very many queries at all. If you pick a good naming convention and stick to it, you should have no problems with many more than that.

Chris
 

Users who are viewing this thread

Back
Top Bottom