Home  |  About  |   Search   

What's New
Table Of Contents
Credits
Netiquette
10 Commandments 
Bugs
Tables
Queries
Forms
Reports
Modules
APIs
Strings
Date/Time
General
Downloads
Resources
Search
Feedback
mvps.org

RunCommand Constants

Terms of Use


 

General: Compact Current Database

Author(s)
Juan M. Afan de Ribera
For Access 2000 and Access 2003. Here is a snippet of code for compacting the current database. It uses the accDoDefaultAction method, that performs the
specified object's default action, and can be run from a command button on a form.

accDoDefaultAction is a method of the hidden IAccessible Class in Office library.

'   ***** Code Start *****
Public Sub CompactDB()

   CommandBars("Menu Bar"). _
   Controls("Tools"). _
   Controls("Database utilities"). _
   Controls("Compact and repair database..."). _
   accDoDefaultAction

End Sub
'   ***** Code End  *****

1998-2009, Dev Ashish & Arvin Meyer, All rights reserved. Optimized for Microsoft Internet Explorer