Command Button: compact data and quit application

  • Thread starter Thread starter SilviHaiku
  • Start date Start date
S

SilviHaiku

Greetings to all participants.

I run an Access97 database.

I have created a command button on Form-A: clicking this button quits the
application.

Now, I would like to add a Compact-Data-Before-Quitting function to this
button. How could I do this?

Of course, I know there is a Compact Data Option in the Tools menu but this
database runs on a network and 3 office colleagues connect to input data and
populate the fields. That is why I would like this Command Button to a)
compact data and b) quit the application.

Thanks for sharing and assisting.

Sylvie
 
Is your application split into a front-end (containing the queries, forms,
reports, macros and modules), connected to a back-end (containing the tables
and relationships), the way it should be? If so, you can check whether the
locking file for the back-end database exists (the .LDB file in the same
folder as the .MDB) and use the CompactDatabase method of the DBEngine
object. What I typically do is rename the existing back-end as a backup,
then run CompactDatabase on that renamed file, creating the "correctly
named" file as the result.
 
Back
Top