Compacting Access 97 Mde File

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is it possible to invoke the compact tool in Access 97 from a MDE file?
If so, how?
If not, any alternative?
 
To compact the current mde or another mdb?

the dbengine object can compact a database ( DBEngine.CompactDatabase ).

- Raoul

example from helpfile
Sub CompactDatabaseX()

Dim dbsNorthwind As Database

Set dbsNorthwind = OpenDatabase("Northwind.mdb")

' Show the properties of the original database.
With dbsNorthwind
Debug.Print .Name & ", version " & .Version
Debug.Print " CollatingOrder = " & .CollatingOrder
.Close
End With

' Make sure there isn't already a file with the
' name of the compacted database.
If Dir("NwindKorean.mdb") <> "" Then _
Kill "NwindKorean.mdb"

' This statement creates a compact version of the
' Northwind database that uses a Korean language
' collating order.
DBEngine.CompactDatabase "Northwind.mdb", _
"NwindKorean.mdb", dbLangKorean

Set dbsNorthwind = OpenDatabase("NwindKorean.mdb")

' Show the properties of the compacted database.
With dbsNorthwind
Debug.Print .Name & ", version " & .Version
Debug.Print " CollatingOrder = " & .CollatingOrder
.Close
End With

End Sub
 
To compact the current mde.

JaRa said:
To compact the current mde or another mdb?

the dbengine object can compact a database ( DBEngine.CompactDatabase ).

- Raoul

example from helpfile
Sub CompactDatabaseX()

Dim dbsNorthwind As Database

Set dbsNorthwind = OpenDatabase("Northwind.mdb")

' Show the properties of the original database.
With dbsNorthwind
Debug.Print .Name & ", version " & .Version
Debug.Print " CollatingOrder = " & .CollatingOrder
.Close
End With

' Make sure there isn't already a file with the
' name of the compacted database.
If Dir("NwindKorean.mdb") <> "" Then _
Kill "NwindKorean.mdb"

' This statement creates a compact version of the
' Northwind database that uses a Korean language
' collating order.
DBEngine.CompactDatabase "Northwind.mdb", _
"NwindKorean.mdb", dbLangKorean

Set dbsNorthwind = OpenDatabase("NwindKorean.mdb")

' Show the properties of the compacted database.
With dbsNorthwind
Debug.Print .Name & ", version " & .Version
Debug.Print " CollatingOrder = " & .CollatingOrder
.Close
End With

End Sub
 
Not possible. this can only be accomplished with another mde which is started
after or before you start the current mde.

I usually use a batch file which stays open as long the mde runs. once
people access the batch will start compacting and backuping.

- Raoul
 
Back
Top