If you have Access 2000 or newer, one of the options in Tools|Options is Compact on Close.
/compact target database or target Access project
Compacts and repairs the Access database, or compacts the Access project that was
specified before the /compact option, and then closes Access. If you omit a target file
name following the /compact option, the file is compacted to the original name and folder.
To compact to a different name, specify a target file. If you don't include a path in
target database or target Access project, the target file is created in your My Documents
folder by default.
In an Access project, this option compacts the Access project (.adp) file but not the
Microsoft SQL Server database.
This is from the help file. You may also want to include /excl to make sure you open it in
exclucive mode.
For the switches to work, you can't just specify the database in the command line, you
have to start with the command for Access.
"<path>\msaccess.exe" "<path>\MyDatabase.mdb" /excl /compact "<path>\compacted.mdb"
--
Wayne Morgan
"ColinWard" <jetfighter3@hotmail.com> wrote in message
news:3f95459c$0$194$75868355@news.frii.net...[color=blue]
> Is there a way to compact the current database when the user clicks the
> exit button. Alternatively, what is the command line switch to compact
> the database when the user opens the database?
>
> Thank you
>
> Colin Ward
>
>
>
>
> *** Sent via Developersdex
http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it![/color]