by www.itmodule.com (4 Submissions)
Category: Databases/Data Access/DAO/ADO
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Sun 7th September 2003
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Compact Access Database
Dim db As Database
Set db = OpenDatabase(srcdbPath)
' Show the properties of the original database.
Debug.Print srcdbPath & ": Version:", db.Version
Debug.Print " CollatingOrder = " & db.CollatingOrder
db.Close
'if the file exist..kill it.
If Dir(trdbPath) <> "" Then
Kill trdbPath
End If
DBEngine.CompactDatabase srcdbPath, trdbPath, , dbEncrypt
' Show the properties of the compacted database
Set db = DBEngine(0).OpenDatabase(trdbPath)
Debug.Print trdbPath & ":Version:", db.Version
Debug.Print " CollatingOrder = " & db.CollatingOrder
db.Close
End Sub