Solved

Compacting an Access 2010 database without opening Access or programmably

Posted on 2013-12-30
2
454 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

839 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