How to Compact and Repair an Access Database
Microsoft Access databases grow over time — even when you delete records, the file doesn’t shrink automatically. Temporary objects accumulate, fragmentation builds up, and performance slows. Compact and Repair is the built-in tool that fixes this. It reduces file size, clears out debris, and repairs minor corruption before it becomes a real problem.
This guide walks you through exactly how to run it — for every version of Access — including what to do when your database won’t open at all.

What Does Compact and Repair Do?
When you run Compact and Repair, Access does two things simultaneously:
- Compacts — reclaims unused space left behind by deleted records, old temp objects, and discarded queries. A database that started at 10 MB can balloon to 100 MB or more over months of use. Compact brings the file back down to its true size.
- Repairs — scans the database for minor structural problems: fragmented data pages, orphaned objects, and VBA module issues. It won’t recover severely damaged files, but it catches small problems before they grow into big ones.
Think of it like a routine tune-up for your car. You don’t wait until the engine fails — you maintain it on a schedule. The same logic applies here.
How to Compact and Repair in Access (Step-by-Step)
Access 2016, 2019, 2021, and Microsoft 365
1. Open your database in Access.
2. Click the Database Tools tab on the ribbon.
3. In the Tools group, click Compact and Repair Database.
4. Access will compact and repair the file automatically. You’ll see a brief pause, then the database reopens.
Note: All other users must be out of the database before you run this. If someone else has the file open, Access will warn you or skip the process entirely.
Access 2010 and 2013
5. Open your database.
6. Click the File tab to open Backstage view.
7. Click Info, then Compact & Repair Database.
The process is identical — only where you find the option is different.
Enable Auto-Compact on Close
You can set Access to automatically compact the database every time you close it:
8. Click File ? Options.
9. Select Current Database from the left panel.
10. Under Application Options, check Compact on Close.
11. Click OK.
This works well for single-user databases. For shared (multi-user) databases, use caution — it fires whenever any user closes the file. If others are still connected, this can cause unexpected behavior or contention. Schedule it for off-hours instead.
How to Compact and Repair When the Database Won’t Open
This is the scenario most how-to articles skip. If your database is too damaged to open normally, you can still run Compact and Repair from outside the file.
Method 1: From Inside Access (No File Open)
12. Launch Access without opening any database. If the file dialog appears, click Cancel.
13. Click Database Tools ? Compact and Repair Database.
14. Browse to your damaged .accdb or .mdb file and select it.
15. Choose a new destination filename — this preserves your original as a backup.
16. Access will attempt to compact and repair into the new file.
Method 2: Command Line
Replace the paths below with your actual Access installation path and database location:
“C:\Program Files\Microsoft Office\root\Office16\MSACCESS.EXE”
“C:\path\to\your.accdb” /compact
If you’re on a 32-bit Office install, look in Program Files (x86) instead. The /compact switch tells Access to compact and close without opening the UI.
If neither method works, the corruption is beyond what Compact and Repair can handle. See our Access database repair service — we recover corrupted .accdb and .mdb files with minimal data loss.
What Compact and Repair Actually Fixes (and What It Doesn’t)
What It Fixes
- File bloat from deleted records, forms, reports, and queries
- Fragmented data pages that slow down table scans and queries
- Minor corruption in tables, queries, and relationships
- VBA compilation issues (especially useful alongside a Decompile — see FAQ below)
- Temporary objects left behind by crashes or improper shutdowns
What It Doesn’t Fix
- Severely corrupted .accdb or .mdb files that Access cannot read
- Corruption caused by hardware failure, bad sectors, or disk errors
- Lost or overwritten records — Compact and Repair doesn’t recover deleted data
- Issues with linked tables, ODBC connections, or external data sources
If you’re running Compact and Repair and the database keeps crashing, errors return immediately after, or you see messages like “unrecognized database format” or “inconsistent state” — that’s a signal the damage is deeper. Our team handles exactly those situations. See our Microsoft Access help and consulting page for more.
How Often Should You Run Compact and Repair?
General recommendation: once a week for active databases with frequent edits and deletions; once a month for lighter usage.
Signs you’re overdue:
- The .accdb file is 2–3x larger than it was when you last compacted
- Queries and forms that used to run quickly are noticeably sluggish
- Random errors appearing on operations that normally work fine
- The database crashed or was shut down abruptly
If you’ve enabled Auto-Compact on Close for a single-user database, you don’t need to think about scheduling — it runs automatically.
When Compact and Repair Isn’t Enough
Compact and Repair is maintenance, not recovery. When your database has serious issues, you need more than routine tools can offer.
Access Experts provides:
- Emergency database repair — recovering corrupted .accdb and .mdb files with minimal data loss
- Rapid response support — live help when your system goes down during business hours ($235/hr Mon–Fri, $325/hr after hours)
- Ongoing Microsoft Access database support — for businesses that need reliable, long-term maintenance and monitoring
- Microsoft Access help and consulting — when you need a bigger fix, an upgrade, or a custom solution built to spec
If you’ve run Compact and Repair and things still aren’t right, contact us for a free assessment. We’ve been fixing Access databases for over 30 years.
Frequently Asked Questions About Compact and Repair
Ready to Fix Your Access Database?
If Compact and Repair didn’t solve the problem, our certified Access experts are ready to help. With over 30 years of Microsoft Access experience, we diagnose and fix database issues fast — so your business stays running. Call us at +1 773.809.5456 or email [email protected] to request a free consultation.
