by Zahid (7 Submissions)
Category: Miscellaneous
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Mon 5th June 2000
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Data Compression: If you previously deleted large amounts of data, run this procedure to reclaim disk space used by deleted records and
Dim DbsAccount As DataBase
Dim Source As String, Target As String
Dim FSo, Fil2
Source = App.path & "\Account.mdb"
Target = App.path & "\Account1.mdb"
On Error GoTo Err_handler
Set DbsAccount = OpenDatabase(Source)
' Show the properties of the original database.
With DbsAccount
Debug.Print .NAME & ", version " & .Version
Debug.Print " CollatingOrder = " & .CollatingOrder
.Close
End With
DBEngine.CompactDatabase Source, _
Target, dbLangKorean
DoEvents
Set DbsAccount = OpenDatabase(Target)
' Show the properties of the compacted database.
With DbsAccount
Debug.Print .NAME & ", version " & .Version
Debug.Print " CollatingOrder = " & .CollatingOrder
.Close
End With
FileCopy Target, Source ' Copy source to target.
Set FSo = CreateObject("Scripting.FilesystemObject")
Set Fil2 = FSo.GetFile(Target)
Fil2.Delete
Exit Sub
Err_handler:
MsgBox Err.Description, vbCritical, "Error"
End Sub
No comments have been posted about Data Compression: If you previously deleted large amounts of data, run this procedure to reclaim di. Why not be the first to post a comment about Data Compression: If you previously deleted large amounts of data, run this procedure to reclaim di.