Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

In vba, tell the mdb to compact itself

Status
Not open for further replies.

OhioSteve

MIS
Mar 12, 2002
1,352
US
I know how to tell ANOTHER mdb to compact itself. How can I tell THIS mdb to compact itself? I tried this but it did not work~

Application.CompactRepair CurrentProject.FullName, CurrentProject.FullName
 
OhioSteve, you can't compact and repair the database via vba when the current database is open i'm afraid.

In Access 2000 and later, there is an option to "compact on close" (in the Tools menu). This may be of use to you, otherwise your only other option would be to initiate a second database, close your first and then have the second compact and repair the first!

Hope this helps!

Nick
 
I know about "compact on close". However, I already do some exporting when the db closes. I do not want to add another task to the shutdown process.

What about using "/compact" in the shortcut?? MS says that that switch compacts the db on startup. But it does not seem to work for me.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top