Solved

Compacting an Access 2010 database without opening Access or programmably

Posted on 2013-12-30
2
448 Views
Last Modified: 2013-12-31
Hello All

I was wondering if it is possible to compact an Access 2010 database without opening Access (like putting the steps into a batch file) or creating a second Access program to do it automatically.

What I would need to have happen is:
1. Automatically each night (around midnight when everyone is off it) a copy of the Access database is made and the older copy (from the night before) is deleted.
2. The original is compacted and repaired.

All with no human interaction (I don't want to have to be up at midnight to answer msg boxes).

Any help is appreciated.
0
Comment
Question by:alevin16
2 Comments
 
LVL 12

Assisted Solution

by:pdebaets
pdebaets earned 100 total points
ID: 39747547
Our free Application Starter utility will do something similar. Rather than compact and backup at midnight, it will do this when the first user opens the application in the morning. http://peterssoftware.com/aps.htm
0
 
LVL 84

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 400 total points
ID: 39747918
You can also run a batch file to do this:

@echo off
cd\ "full path to your backup folder"
del "full name of your backup file"
copy /y "full path to your database" "full path to your backup file"
cd\"full path to the office folder"
msaccess.exe "full path to your database" /compact

Save this as a Batch file (perhaps name it "CompactMyDB.bat"), and then run that as needed. You can schedule this to run through the Windows Scheduler if needed.

Be sure to use full paths to all files, including the name and extension of the file EXCEPT for the cd\ lines - those are "change directory" lines, and you only use the folder path for those.

See this for more information on Batch file commands:

http://www.robvanderwoude.com/batchcommands.php
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

919 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now