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

Repair/Compact DB

Status
Not open for further replies.

mbaddar

Programmer
May 10, 2001
120
US
Hi,

I'm developing an application where I want to provide a user with the option of Repairing/Compacting a database.
I've never done this before so I'm not sure if I'm on the right track. The database I'm trying to repair is "CatalogDB.mdb" and it's in the same directory as my application.

Does my code below look approximately right?

Me.Application.CloseCurrentDatabase
DBEngine.RepairDatabase app.path & "\CatalogDB.mdb"
DBEngine.CompactDatabase app. path & "\CatalogDB.mdb", app.path & "\CatalogDB.mdb"

I have this code under a command button and when I click on the button my form closes and my project stays open. To be honest, I'm really not sure whether it's working.

Thanks for any help.

MBaddar
 
Sounds like it's working. You could always check the file size in Windows Explorer before and after pushing of the button.

Just a thought.

ljprodev@yahoo.com
ProDev
MS Access Applications
 
Hi Lonnie,

That's a good idea. You know, though, I just noticed that my project is closing. So, I don't think anything is executing after my closecurrentdatabase line. But, I'll check your idea about looking at the filesize.

Thanks,
MBaddar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top