Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 386
  • Last Modified:

open database2 from vb code in database1 - db2 will then compact db 1

I have an importing database scheduled to run early morning.  I need to compact this database after importing.  I can compact the db using another database but struggling to code the compacting database to open after importing is complete then close the importing database
1 Solution
Try this:
After the importing is done, set a boolean field in a table that is linked to the scond database, then close the first database.  In an on timer event in the second database, check the value of the boolean.  Once it changes, Pause for a few seconds (time for the first database to close) then run your maintenance routine.  after the routine is done, reset the boolean.
Use Task Scheduler if you have it to launch and execute your compacting database at a later time (say a few hours later) - is that an option ?

Alternatively, are you importing into linked tables ? If so, you can simply compact the database where the tables reside from the front-end database.
jpsFWAuthor Commented:
I split out the importing side of the database and set this database to run on scheduler - i didn't realise there was a compact on close option so have set that to yes as the only time the database opens is to import.

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now