WalkieTalkie
Technical User
I have an Access 97 database on a network, split into front-end, back-end. I want to archive all the records that are older than 2 years into another back-end (archive_be.mdb). I have written some code that will run some append and delete queries to copy the records, then delete them from the original back-end. The purpose of this is to limit the size, to improve performance etc (currently some of the tables have around 60,000 records)
My problem is that users need the ability to switch the link from the front-end, so they can use the same forms to switch between data from both back-ends. I have tried using the Connect and RefreshLinks methods but am having no success. Can anybody help?
The code I have tried so far is:
The error I am getting is:
'Run-time error 3268: Can't set this property once the object is part of a collection', pointing to the line tblNewLink.SourceTableName = "tbl1"
I have tried leaving out the 'Set tblNewLink = dbs.TableDefs("tbl1")', but of course then get an error saying that the object variable isn't set.
Any help will be much appreciated!
'
My problem is that users need the ability to switch the link from the front-end, so they can use the same forms to switch between data from both back-ends. I have tried using the Connect and RefreshLinks methods but am having no success. Can anybody help?
The code I have tried so far is:
Code:
Dim dbs As Database, tblNewLink As TableDef
Set dbs = CurrentDb
Set tblNewLink = dbs.TableDefs("tbl1")
tblNewLink.Connect = ";DATABASE=C:\Archive\Archive_be.mdb"
tblNewLink.SourceTableName = "tbl1"
Set dbs = Nothing]
The error I am getting is:
'Run-time error 3268: Can't set this property once the object is part of a collection', pointing to the line tblNewLink.SourceTableName = "tbl1"
I have tried leaving out the 'Set tblNewLink = dbs.TableDefs("tbl1")', but of course then get an error saying that the object variable isn't set.
Any help will be much appreciated!
'