0

Hi all,
Is it possible to programatically "Compact and Repair" an mdb file as can be done manually from MSACCESS menu "Tools"-> "Database Utilities" -> "Compact and Repair Database..."
Any help will be appreciated...

Rajesh Khanna

3
Contributors
2
Replies
3
Views
9 Years
Discussion Span
Last Post by JA12
0

Hi all,
Is it possible to programatically "Compact and Repair" an mdb file as can be done manually from MSACCESS menu "Tools"-> "Database Utilities" -> "Compact and Repair Database..."
Any help will be appreciated...

Rajesh Khanna

Apparently, Yes.

http://office.microsoft.com/en-gb/access/HA010345701033.aspx?pid=CL100570041033

"Run Microsoft Visual BasicĀ® for Applications (VBA) code that uses the CompactDatabase method of either Microsoft Jet and Replication Objects (JRO) or Microsoft Data Access Objects (DAO)."

'Compact the database
    DB_sour = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" _
        & strSourcePath & ";" & "Jet OLEDB:Database Password=" & strPassword
& ";"

    DB_dest = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" _
            & strTempFile & " ;Jet OLEDB:Engine Type=5;" & _
            "Jet OLEDB:Database Password=" & strPassword & ";"

    JROje.CompactDatabase DB_sour, DB_dest
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.