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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

code to compact an open DB

Status
Not open for further replies.

Lavey

IS-IT--Management
Jun 1, 2001
115
DE
Hi,

Ive been trying to put together some code behind a button to compact an open database (using docmd.runcommand - compact), i get an error message saying that you cannot do this with code or macro's, but i've heard of some neat pieces of code that can do this.

Can anybody help me out with this, or point me to some samples.....

Thanks alot in advance!!
 
I use RunCommand with CompactDatabase and it works fine. This is in Access 97, though, so your version may differ. Alex Middleton
 
I am in Access 97, and it is asking me for a path when I use that command. I would like to be able to have it either 1) assume that the database has the same name, or 2) let me put a new name through with code.

I actually would be happy with some code that allowed me to compact a database when it is closed, provided with a .mdw file. Since I have security through a .mdw file, I cannot use the DBEngine.CompactDatabase method.
 
In the modules section of you'll find a couple different examples for things having to do with compacting DB's through code. Why don't you check it out and see if anything applies.

HTH Joe Miller
joe.miller@flotech.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top