G
Greg_W via AccessMonster.com
Hi all,
I am developing a process for copying (backing up) tables from the main
database into an archive database. For this, I use a simple Make-Table query
definition and the execute command in VBA. The VBA code tags today's date
onto the end of each archived table, giving each added table a unique name.
It works great.
However, I also need a way to purge out the older tables from that archive
database, for example, all tables that were created longer than six months
ago. Otherwise the archive db would gradually grow to monstrous sizes (or
maybe that would never be a problem, what do you think?).
I figure I have to open the database before I can purge the older tables. I
use the following code to do this:
'=========================================================
Dim apl As Access.Application
Dim tbl As TableDef
Dim db As DAO.Database
Set apl = CreateObject("Access.Application")
apl.OpenCurrentDatabase FilePath:="D:\TEST_Archive.mdb", Exclusive:=True
apl.Visible = False
Set db = apl.CurrentDB
'Code to purge the unwanted tables goes here.
'=========================================================
The problem I have, however, is that the Security Warning pops up, which
requires user input and defeats the whole purpose of making this an automated
process.
Is there a way to accomplish this without opening the database? Or is there a
way to automatically bypass the security warning through VBA?
I am developing a process for copying (backing up) tables from the main
database into an archive database. For this, I use a simple Make-Table query
definition and the execute command in VBA. The VBA code tags today's date
onto the end of each archived table, giving each added table a unique name.
It works great.
However, I also need a way to purge out the older tables from that archive
database, for example, all tables that were created longer than six months
ago. Otherwise the archive db would gradually grow to monstrous sizes (or
maybe that would never be a problem, what do you think?).
I figure I have to open the database before I can purge the older tables. I
use the following code to do this:
'=========================================================
Dim apl As Access.Application
Dim tbl As TableDef
Dim db As DAO.Database
Set apl = CreateObject("Access.Application")
apl.OpenCurrentDatabase FilePath:="D:\TEST_Archive.mdb", Exclusive:=True
apl.Visible = False
Set db = apl.CurrentDB
'Code to purge the unwanted tables goes here.
'=========================================================
The problem I have, however, is that the Security Warning pops up, which
requires user input and defeats the whole purpose of making this an automated
process.
Is there a way to accomplish this without opening the database? Or is there a
way to automatically bypass the security warning through VBA?