Buck Beasom
asked on
Using Queries with a Linked Database
I'm building an application that manages a large amount if imported data and is used by a number of users. I have split the tables out from the rest of the application in the usual way, with the "Back End" parked up on the server.
Unfortunately, at the request of the user group, I can't embed the various queries in the code - as is my usual practice. Instead, the query names are stored in a table and executed in a sequence managed within that table.
Equally unfortunate, however, is that this methodology requires all of the queries to reside in the BACK END .accdb. In addition, any Make Table queries that are executed break the links to the back end tables and replace them with the new tables in the client .accdb.
Both of these are a royal pain in the neck!
Is there a way around this, assuming that use of the "DoCmd.OpenQuery strQueryName" method is something I am stuck with?
Thanks.
Unfortunately, at the request of the user group, I can't embed the various queries in the code - as is my usual practice. Instead, the query names are stored in a table and executed in a sequence managed within that table.
Equally unfortunate, however, is that this methodology requires all of the queries to reside in the BACK END .accdb. In addition, any Make Table queries that are executed break the links to the back end tables and replace them with the new tables in the client .accdb.
Both of these are a royal pain in the neck!
Is there a way around this, assuming that use of the "DoCmd.OpenQuery strQueryName" method is something I am stuck with?
Thanks.
You might want to take a look at my article on Creating and Using Temporary Tables.
Additionally, you indicate that " this methodology requires all of the queries to reside in the BACK END .accdb"; this is not true. Although the Table containing the query names resides in the BE, the code (and queries) are still processed in the FE; the queries must reside in the Front End.
Also, if you are running ACTION queries (Make table, Append, Delete, Update) then you should not be using DoCmd.OpenQuery, you should be using the Execute method, like:
db.Execute strSQL, dbFailOnError
OR
db.QueryDefs("QueryName"). Execute dbFailOnError
Additionally, you indicate that " this methodology requires all of the queries to reside in the BACK END .accdb"; this is not true. Although the Table containing the query names resides in the BE, the code (and queries) are still processed in the FE; the queries must reside in the Front End.
Also, if you are running ACTION queries (Make table, Append, Delete, Update) then you should not be using DoCmd.OpenQuery, you should be using the Execute method, like:
db.Execute strSQL, dbFailOnError
OR
db.QueryDefs("QueryName").
ASKER
Fyed.
Thanks. Your comments helped, but before closing the question I would like some more input on the alternative query execution methods you provided. Why are these better for Action queries than DoCmd?
Thanks.
Thanks. Your comments helped, but before closing the question I would like some more input on the alternative query execution methods you provided. Why are these better for Action queries than DoCmd?
Thanks.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks. I did notice that if I am executing a query that joins a query and a table, the query for the embedded SQL must be in the back end .accdb, but that is the only case.
Open in new window
You can use an IN clause to specify a given database.