How to programmatically open a different database (.mdb) from within a command button?

  • Thread starter Richard Hollenbeck
  • Start date
R

Richard Hollenbeck

I have some code for compacting and repairing my current
database, but, as it is well documented, we cannot do that. As
far as I know we can only compact and repair a database that is
closed. So I put the code in another database
(CompactRepair.mdb) that will run that code. This works! But how
can do something like this (This is pseudocode):

If LastCompactDate <= now() -10 then
open this file: CompactRepair.mdb
close original database
End If

and then from CompactRepair.mdb open the original database after
the compacting is done?

I tried putting the compacting code inside a form in the original
database but I got a "Permission Denied" error, and I think it's
because the database is open.

Thanks.
 
Top