Menu

Compact and Repair Database

Help
2016-01-12
2016-01-13
  • Dario Ferrante

    Dario Ferrante - 2016-01-12

    Dear Marco,
    Is there a method in UCanAccess to compact the access DB without use the internal function "Compact and Repair" into MS Access?

    Thank you.

    Dario.

     
  • Marco Amadei

    Marco Amadei - 2016-01-12

    Unfortunatly there isn't. There could be a way to programmatically call the API on which is based the "Compact and Repair" tool. But obviously this way is platform/windows dependent.

     

    Last edit: Marco Amadei 2016-01-12
  • Gord Thompson

    Gord Thompson - 2016-01-13

    As Marco mentions, any built-in way of doing a Compact and Repair Database operation from UCanAccess would only work on Windows machines, and even then it would only work if the required version of the Access Database Engine was installed. That would involve 32-bit vs. 64-bit execution environments, .accdb vs. .mdb requirements, and the headaches that go with them.

    There is also a fairly strong argument against performing a Compact and Repair Database operation programatically. Yes, C+R can solve a lot of problems with corrupted database files but it can also permanently destroy data that could otherwise be recovered (e.g., if the primary key for a table contains an invalid data page).

    Compact and Repair Database operations should not be taken lightly. They should be done with appropriate planning and due care. The only time that I would recommend that it be done programatically would be when Microsoft Access itself was not installed and the user wanted to do the C+R using just the Access Database Engine.(on Windows). In that case a simple VBScript or PowerShell script would be sufficient.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.