Connecting Tech Pros Worldwide Help | Site Map

Compacting a database on close

  #1  
Old November 12th, 2005, 03:33 PM
ColinWard
Guest
 
Posts: n/a
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!
  #2  
Old November 12th, 2005, 03:34 PM
Wayne Morgan
Guest
 
Posts: n/a

re: Compacting a database on close


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]


Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
Compact Database on Close - Good Idea or Not? Susan Bricker answers 5 November 13th, 2005 10:06 AM
Corruption when "Compact on Close" active smitty mittlebaum answers 1 November 13th, 2005 01:45 AM
Compact/Compact on Close James Franklin answers 13 November 12th, 2005 05:31 PM
Compacting a database on close ColinWard answers 2 November 12th, 2005 03:00 PM