Is there a way to repair and compact an MS access 97 database via VB code?
Thanks,
Thai
Printable View
Is there a way to repair and compact an MS access 97 database via VB code?
Thanks,
Thai
It's Simply easy.
To Compact a DataBase just write
DBEngine.CompactDatabase DBName, NewDBName
To Repair a DataBase
DBEngine.RepairDatabase DBName
Where DBNAME is your DataBase
And NewDBNAME is the database after compact.
If you place your cursor on the word CompactDatabase and then press the F1 key, you will see more info.
I hope that helps you
Hello John. Is there a reference or a component I must install before using DBEngine? Thanx
in order to run the code John_Andrikopoylos gave, you need a reference to DAO.
Note: that version 3.6(and above) of DAO does not have a repair method. The Repair method and the Compact method have been consolidated into the Compact method alone.
Also, if you program already has a reference to ADO then you should look into using the JRO libraries instead of DAO.
Thanks dude. I already solved this using JRO, which repairs and compacts the DB.