views:

144

answers:

2

I'm trying to split a database into two pieces -- a backend that updates automatically, and a front-end that allows searching and adding/editing comments. The data in the source database is pulled together from multiple tables into a pair of queries, and I want to use these queries as the source of the current database.

Access 2007 supports splitting a database into multiple pieces, but not in the way I'm looking for. It keeps the tables in the source database and puts all the forms, queries, reports, and macros into the new database. The tables and queries are already in the back-end, and this new database should just provide a good GUI to the end-user.

Access 2007 also supports linked tables, but these can only use a table as a source, not a query object.

I was thinking that the best way to do this would be to do a SQL query along the lines of

SELECT * FROM SourceQuery IN "C:\Path\To\ExternalDB.accdb";

Is what I'm working towards even possible, and would this be the best way to do it?

Since its still relatively early in the project, rearchitecting the database isn't out of the question, but is something I'd prefer to avoid.

+1  A: 

Hope I'm understanding you correctly, but the most sensible solution would be to link the tables in the backend DB and copy the queries to the UI database. Those queries would still be able to access the uderlying tables (via the linked tables) without issues and would be accessible through normal means to your forms and VBA code.

Is there a particular reason you don't want the queries in the UI database?

JohnFx
There is a specific reason to keep the queries in the backend: there are a few code modules: one which prepares a block of data for import and one that exports the results of a pair of queries to spreadsheets. Since the backend will be on a server and the goal is to have only the UI distributed to the users, I'm not sure where these code modules will end up after the split.
A. Scagnelli
Queries in the back end that depend on UDFs in code modules in the back end will not be executable by the clients unless you have a reference to the back end with the code in it. Stop fighting with Access and architect your application the way Access was designed, with everything but the data tables in the front end.
David-W-Fenton
David is right. When you find yourself fighting the platform, you are probably doing it wrong. If you have code (and queries count as code, not data) in the backend, then it is no longer a back-end.
JohnFx
+1  A: 

You described the usual Access BE-FE division correctly: only tables in the back-end. I'm aware not all DB programs do it that way, but this is Access and my approach would be to honor the usual division. (And you hardly have a choice in that you can't "link to a query" in Access.)

Reviewing your comment ('There is a specific reason ...'), I think this would possibly mean

  1. adding a few more tables to the back-end, essentially buckets (import-data in ready form; export 1; export 2) that allow all users to get to consistent processed data;
  2. making a small admin FE that sits next to the BE and stores your modules, queries for export, and export routines; and
  3. having some redundant queries on the user FE. This is vexing in my own work. I just try to design sturdy stable "building block" queries in those roles, and keep their number to a minimum.
Smandoli
On review, I think ideas 1 and 3 are probably redundant. You'd need to EITHER make some bucket tables OR have queries on the user FE that echo the BE. I use #1 sometimes and #2 sometimes -- depends on the function at hand.
Smandoli