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.
-- Doug Steele, Microsoft Access MVP http://I.Am/DougSteele (no private e-mails, please)
"SilviHaiku" <sdrsolo[ at ]openface.ca> wrote in message news:%23$iApW2zGHA.4796[ at ]TK2MSFTNGP06.phx.gbl...
[Quoted Text] > 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 > >
|