Click to See Complete Forum and Search --> : Repair/Compact DB
Thai
Jun 19th, 2000, 03:46 AM
Is there a way to repair and compact an MS access 97 database via VB code?
Thanks,
Thai
John_Andrikopoylos
Jun 19th, 2000, 06:12 AM
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
Radames
May 21st, 2003, 01:20 PM
Hello John. Is there a reference or a component I must install before using DBEngine? Thanx
frigginjerk
May 21st, 2003, 05:26 PM
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.
Radames
May 22nd, 2003, 02:21 PM
Thanks dude. I already solved this using JRO, which repairs and compacts the DB.
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.