|
|
Compact Current Database Release Notes
Version 2.0, March 14, 1999OverviewThe topic of how to compact the currently-opened database from code has come up frequently on the Access newsgroups. Although there is a menu command that can be used to accomplish this in Access 97, it isn't available from VBA code. Somebody recently posted some very clever VB code that could be used to create a separate program to accomplish this task (if someone knows who it was, please let me know so I can give them credit). The basic idea was to use GetObject to control the currently-running instance of Access, and use Automation methods to close, compact, and reopen the database. My only problem with doing this in VB is that I dislike the idea of a 2-disk install program for such a small utility. My solution was to convert the code to C++, so that the end result is a small EXE that doesn't require any runtime DLL's or a special install program. The main thing that has changed with version 2 is that I have added support for several command-line parameters:
The other addition I've made is a BAS module that contains a CompactCurrentDatabase() function in it. This function uses the ShellExecute API to launch CompactCurrent rather than the Shell statement. This should avoid the problems mentioned below. This should make it easier to use CompactCurrent if you aren't used to making API calls and don't want to use the Shell statement. A special thanks to Michael Dunphy for helping me get to the bottom of the GetActiveObject() problem that occurs when using the Shell statement (see below). Known IssuesIf you find any bugs, please send me email. There are a few things you should know about the Shell statement in Access that can cause problems with CompactCurrent:
Future EnhancementsI said before that I wouldn't make any more changes, and look what happened. This time I really mean it, though. I'll fix any bugs that get reported to me, but I won't be doing another upgrade to CompactCurrent. I don't even do programming in Access anymore, so this utility has little use for me. I've supplied the sourcecode for anyone who would like to take over development. FreewareThis program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |