Hello everybody...
How to compact and repair database Access 2000
using DAO in VB5.
Any Suggestion from you all...
Printable View
Hello everybody...
How to compact and repair database Access 2000
using DAO in VB5.
Any Suggestion from you all...
You need to use DAO360.dll. I'm not sure if it is included in the MDAC2.1 Update. Choose 'Project > References' from the file menu and select 'Microsoft DAO 3.6 Object Librairy'. You need to create an instance of it like so:
dim var as DBENGINE
set var = new DBEngine
var.Compact databasesource,databasedest
With Version 3.5 there were 2 separate methods. 1 for compact and 1 for repair. Now with version 3.6 the compact also does a repair in the same function. With the compact method, you must select a new destination for the compacted DB, but here is a way around that, simple but effective:
var.Compact databasesource,databasedest
kill databasesource
filecopy databasedest,databasesource
You need to add the require error handling to ensure you don't kill your source database if a compacted database was not created.
The reason you cannot use version 3.5 is because it does not support 2000 databases. :)