Dwight
Garry Robinson wrote an article on this ... here's an excerpt:
What Is A Remote Query ?
It always amazes me how I can keep stumbling across features that I never
ever noticed or read about in the 8 years that I have been programming
Access databases. This article discusses one of those hidden gems that I
discovered when investigating Access Automation. Whilst looking into that
technology, I stumbled across a SQL help topic in Access that described an
extension that allows you to point your current query to a table in another
database. This in itself didn't seem all that interesting because I had been
doing this for years using Linked tables. Then I noticed that you could also
point your local query to a query that was in another Access database. No
links, no local query definitions, this was starting to get interesting.
Unfortunately the technology doesn't really come under any great heading so
for the purposes of this article, I have come up with my own term for these
queries and that is remote queries. Hopefully the discussions will help you
to use these queries in the correct place once you understand what it is you
have to do.
The "In Database" Clause Extension To SQL
As you will probably be very familiar with switching from query design mode
to SQL queries, a remote query can be best described with the following
example of SQL
SELECT [Orders Qry].* FROM [Orders Qry]
IN 'C:\msoffice97\Office\Samples\Northwind.mdb';
This example opens the orders query from my local Northwind database. No
links, no tables.
INSERT INTO Orders ( CustomerID, EmployeeID, OrderDate )
SELECT Orders.CustomerID, Orders.EmployeeID, Orders.OrderDate
FROM Orders IN 'C:\msoffice97\Office\Samples\Northwind.mdb';
This example would transfer the some of the fields in from a remote location
of Orders table in the Northwind database into a local version of the same
table.
How Do You Set Up A Remote Query Manually ?
Remote queries are really a no-brainer to setup manually once you have seen
an example. First open a query and do not select any tables. Choose Menu
View and display Properties. Now replace (Current) in the Source Database
property with the full path to the remote database that you want to display.
An example of this is show in figure 1 where I have setup to return all the
rows from the Orders query in the Northwind database. Now that you have
added your database, you can choose the Query menu and choose Show Table.
You will find this same button on your query design toolbar. Now all the
tables and queries will be visible from the remote database as shown in
figure 2.
A word of warning. This manual design of remote queries is terrific for
initial development but you must be very careful if you are transferring the
application to a new location as it is very likely that the path the remote
database takes will change and this time you will not have any Add-In like
the Linked Table manager to manage these changed paths.
Regards
Jeff Boyce
Microsoft Office/Access MVP
Dwight said:
Is it possible to programatically run a query that is located in the
back-end
database. My front-end has a form that allows users to run canned queries
by
clicking a button on the form.
The FE is loaded on each users PC and the BE is located on a shared drive.
I am trying to avoid releasing a new FE everytime I have to modify or add
a
query to the form.
Thanks in advance!