P
Phred Bear
I want to compact a closed db from another db in vba but not using the
CompactDatabase dao command because you can only do this if you copy the
result to a new db, which I really do not want to do.
dbOne is the closed db and dbTwo is the controling db
Code in dbOne
Sub CompactTables()
CommandBars("Menu Bar"). _
Controls("Tools"). _
Controls("Database utilities"). _
Controls("Compact and repair database..."). _
accDoDefaultAction
End Sub
Code in dbTwo
Sub RunAuto(AutoSub As String)
Dim RemoteDB As Object
Set RemoteDB = GetObject("d:\Remote.mdb")
RemoteDB.Run AutoSub
RemoteDB.Quit
Set RemoteDB = Nothing
End Sub
Sub DoIt() ' the procedure attached to the button on the form to run
the sequence
'RunAuto ("RunEmptyTables")
'RunAuto ("CompactTables")
'RunAuto ("RunRepopulateTables")
End Sub
Many thanks
CompactDatabase dao command because you can only do this if you copy the
result to a new db, which I really do not want to do.
dbOne is the closed db and dbTwo is the controling db
Code in dbOne
Sub CompactTables()
CommandBars("Menu Bar"). _
Controls("Tools"). _
Controls("Database utilities"). _
Controls("Compact and repair database..."). _
accDoDefaultAction
End Sub
Code in dbTwo
Sub RunAuto(AutoSub As String)
Dim RemoteDB As Object
Set RemoteDB = GetObject("d:\Remote.mdb")
RemoteDB.Run AutoSub
RemoteDB.Quit
Set RemoteDB = Nothing
End Sub
Sub DoIt() ' the procedure attached to the button on the form to run
the sequence
'RunAuto ("RunEmptyTables")
'RunAuto ("CompactTables")
'RunAuto ("RunRepopulateTables")
End Sub
Many thanks