Quick answer: Compact and Repair rebuilds an Access `.accdb`/`.mdb` into a cleaner file: it reclaims unused space, rebuilds indexes, and often clears minor corruption. Use File > Info > Compact & Repair Database with exclusive access. It fixes most bloat and light damage—not every broken system table or near-2GB disaster. If Access Compact and Repair is not working, clear locks first, then treat deep corruption as a recovery job.
This is the practical how to compact and repair access database walkthrough—menu steps, Compact on Close, and why the tool fails. It is maintenance and light repair, not a full corruption playbook. Path/permission write failures after a successful open are a different class—see Access runtime error 3044. If Compact and Repair can't touch the damage at all—objects won't import, tables are unreadable—go straight to Access database corruption recovery.
How to Compact and Repair an Access Database
Always copy the file first. Compact is usually safe; “usually” is not a backup strategy.
Manual Compact & Repair (database already open)
- Make sure you are the only person in the file (no coworkers, no scheduled tasks, no hung Access).
- Click File.
- Open Info (Backstage).
- Click Compact & Repair Database.
- Wait for Access to finish and reopen the database.
- Spot-check a few tables and a form you care about.
On some Microsoft 365 builds you also see Database Tools > Compact and Repair Database on the ribbon—same operation, different door.
Manual Compact & Repair (database closed)
- Open Access without opening the problem file (blank session or another trusted file).
- Go to File > Info.
- Click Compact & Repair Database.
- In the dialog, select the `.accdb` or `.mdb` you want to compact.
- Confirm and wait. Access processes that file and returns you to a usable session.
Use this path when the file will not stay open long enough to reach the ribbon, or when you prefer compacting from outside the live app UI.
Where the compacted file goes
Access creates a temporary compacted copy in the same folder as the original (it needs room and permission to write that temp file). When the compact succeeds, it replaces the original database with the compacted version. Your old file name stays the same; you do not get a second permanent “Database1.accdb” unless you canceled mid-process or pointed the dialog elsewhere. If compact fails halfway, keep your pre-compact backup—do not assume the original is untouched.
Set Compact on Close
- Open the database.
- Go to File > Options > Current Database.
- Check Compact on Close.
- Click OK, then fully close and reopen once to confirm the setting stuck.
Compact on Close is fine for a single-user desktop file you control. On a shared multi-user back-end it is a poor default: the last user out triggers compact while others may still be connecting, and a long compact blocks the team. Prefer a scheduled exclusive window instead.
Command line (/compact) for IT
Advanced users can run Access with the `/compact` switch, for example:
`msaccess.exe "C:\Path\YourDb.accdb" /compact`
Syntax and quoting vary by Office bitness and install path. Use it for scripted maintenance after a verified backup—not as your first DIY click. Still require exclusive access; the switch does not bypass locks.
Why Compact and Repair Isn't Working
Another user or process still has the file open
Compact needs exclusive control. If a `.laccdb` is present or Task Manager still shows MSACCESS.EXE, Compact and Repair fails or never starts cleanly. Close every session, clear a stale lock only when nobody is connected, then retry. Full lock-file breakdown: Access database locked for editing.
Near or over the ~2GB Access file limit
ACE/Jet databases have a practical 2GB ceiling. When the file is near that limit, compact may fail, hang, or finish without giving you usable headroom because there is nothing left to reclaim. You need archival (move old data out), a split design, or SQL Server—not another compact pass.
Network drive or cloud-sync folder
Compacting across a slow VPN, flaky Wi‑Fi share, or OneDrive/Dropbox folder often times out or leaves a worse file. Copy the database to a local non-sync folder, compact there, test, then copy the good file back to a proper file server share. Sync folders and live Access maintenance do not mix.
Corruption deeper than Compact and Repair can reach
If table definitions or system objects are damaged, you may still see "Unrecognized Database Format," objects that will not open, or VBA that will not compile after compact “succeeds.” That is not bloat—that is structural damage. Stop looping Compact and Repair on the only copy. If Compact and Repair can't touch the damage at all—objects won't import, tables are unreadable—go straight to Access database corruption recovery.
Insufficient folder permissions
Compact must create a temporary file beside the database. If the account has Read but not Modify (create/write/delete) on the folder, you get permission errors or a failed compact that looks mysterious. Same folder-rights class of problems shows up in error 3044 when writes fail after open. Fix ACLs, then compact a local copy you own.
Book Free Consultation
Compact and Repair keeps failing after locks are clear and you have a backup? We diagnose size, path, and deep corruption on a copy—before another pass makes recovery harder.
Book Free ConsultationWhen Compact and Repair Fails, What Are Your Options?
If the built-in tool cannot finish—or finishes and the database is still broken—you have two honest paths: restore from a recent verified backup, or recover objects manually into a new blank database (import tables in batches, decompile VBA when needed, rebuild what will not import). That sequence is covered step-by-step in Access database corruption recovery—this guide stops at Compact and Repair on purpose.
When DIY import and restore are not enough, the natural next step is a structured repair through our database corruption repair service—the same place we take client files that already failed Compact and Repair.
Frequently Asked Questions
Only when everyone is out and no `.laccdb` sessions remain. Compact needs exclusive access. Back up first; compact during a maintenance window, not mid-shift.
Sometimes indexes rebuild larger, or there was little reclaimable space. Test on a local exclusive copy. Ongoing growth usually means real data or leftover objects, not a broken compact command.
It clears many minor corruption and bloat cases. Severe damage to table definitions or system objects needs backup restore or professional recovery—not endless compact loops.
Busy multi-user back-ends: weekly or after large deletes/imports. Quiet single-user files: less often. Prefer scheduled exclusive compact over Compact on Close for shared production.
Open sessions/`.laccdb`, weak folder permissions, network or sync paths, near-2GB size, or corruption past what Compact and Repair can reach. Clear locks, compact a local copy with Modify rights, then escalate if errors remain.
Need help moving from advice to implementation?
We can review the workbook, Access database, or workflow behind this article and tell you the safest next step before you spend time fixing the wrong thing.