easy question about querydef object

normajean

Registered User.
Local time
Today, 03:18
Joined
May 3, 2003
Messages
22
At least I think it should be easy, but I can't find an answer in books or on the web.
The purpose of the query is to create a temporary local Access table using a passthrough to a SQL database. (based on user login).
#1: My application first creates a SQL pass-through, then a make-table query that references the pass-through.
My question is this: Would it make for better performance if I just changed the .SQL in the pass-through (that underlies the make-table query) instead of re-creating both queries each time? I'm thinking that this would keep the query optimization thats already been created. (Or maybe if I change the .SQL it has to re-optimize so no benefit?)
And #2: I can't find any code samples on how to check whether a querydef already exists in the local database (besides trying to delete it and checking for an error). If the answer to question #1 is that I should only re-create the queries when they don't already exist, then how can I check for that?
Many thanks in advance for sharing your knowledge!
Normajean
 
A Pass-Through query uses SQL syntax native to the receiving DB Engine, not Access Sql which a tad different than others. The SQL also runs in the other engine, so if you created an INSERT pass through query, it would run on the server DB, not in your local ACCESS copy. So basing a make table query on the Pass-Through query is one way. Of course if it is always the same table, you could just link the external table and use 1 access query to run against it.
You can roll through the QueryDefs checking each name to see if it exist. If you are going to delete them anyway, you can issue the delete command and catch any errors if it does not exist and simplify things.
 

Users who are viewing this thread

Back
Top Bottom