Cheesewoman
Registered User.
- Local time
- Today, 08:21
- Joined
- Nov 28, 2014
- Messages
- 11
Hi all,
I have an Access 2010 database that I am developing at work. I recently split the database (using the wizard) into the front end database with the interface and all the queries/reports etc., and the back end with just the tables.
That's all fine, and my front end database shows the tables with little arrows in the navigation pane which indicates that the split worked and the tables are all linked.
I have successfully gotten as far as opening a new instance of access and the "back end" database (using pseudo names in code) and then running a couple of simple queries from the code:
That all works fine. However the issue I'm having is after these lines of code, where I have quite a few OpenQuery commands which should run the queries within the database, such as;
I have tried getting the query to run from within the back end database;
but of course it can't find the query because it's actually in the front end database.
I'm guessing that I need to reference the backend database in the query itself so it knows where to look, but I'm not entirely sure how to go about it, or if it's the right way to do it (or if it's even necessary, I thought that having a split database would automatically link the tables and queries so it would know where to look??)
I hope I've provided enough information to get the idea...
Please help!!
I have an Access 2010 database that I am developing at work. I recently split the database (using the wizard) into the front end database with the interface and all the queries/reports etc., and the back end with just the tables.
That's all fine, and my front end database shows the tables with little arrows in the navigation pane which indicates that the split worked and the tables are all linked.
I have successfully gotten as far as opening a new instance of access and the "back end" database (using pseudo names in code) and then running a couple of simple queries from the code:
Code:
Dim acc As Access.Application
Dim db As DAO.Database
Dim strDbName As String
strDbName = "filepath/backEndDatabaseName.accdb"
Set acc = New Access.Application
Set db = acc.DBEngine.OpenDatabase(strDbName, False, False)
acc.OpenCurrentDatabase strDbName
acc.DoCmd.DeleteObject acTable, "TempTable"
acc.DoCmd.TransferSpreadsheet acImport, , "TempTable", "filepath/filename.xls"
That all works fine. However the issue I'm having is after these lines of code, where I have quite a few OpenQuery commands which should run the queries within the database, such as;
Code:
DoCmd.OpenQuery "Query_ConvertImportDates", acViewNormal
I have tried getting the query to run from within the back end database;
Code:
acc.DoCmd.OpenQuery "Query_ConvertImportDates", acViewNormal
but of course it can't find the query because it's actually in the front end database.
I'm guessing that I need to reference the backend database in the query itself so it knows where to look, but I'm not entirely sure how to go about it, or if it's the right way to do it (or if it's even necessary, I thought that having a split database would automatically link the tables and queries so it would know where to look??)
I hope I've provided enough information to get the idea...
Please help!!
