psulions83
Board Regular
- Joined
- Nov 16, 2015
- Messages
- 127
I have seen a lot of threads on compacting and repairing a dB from excel. I have not been able to get anything to work properly.
I have the below code....Is there a way to get the compact and repair to work after I delete the data in my tables?
Sub accessMacro()
Dim appAccess As Access.Application
Set appAccess = New Access.Application
appAccess.OpenCurrentDatabase "FILE LOCATION" 'Location of the Access dB
appAccess.Visible = False
Application.DisplayAlerts = False
appAccess.DoCmd.RunMacro "Mcro_DelTbls" 'Macro to delete the tables in Access dB
appAccess.DoCmd.SetOption "Auto Compact", True 'Compact and Repair after deleting data from tables
appAccess.DoCmd.RunMacro "Mcro_V2" 'Macro to run th
ActiveWorkbook.RefreshAll
appAccess.CloseCurrentDatabase
ActiveWorkbook.Activate
MsgBox "DONE", vbCritical
End Sub
I have the below code....Is there a way to get the compact and repair to work after I delete the data in my tables?
Sub accessMacro()
Dim appAccess As Access.Application
Set appAccess = New Access.Application
appAccess.OpenCurrentDatabase "FILE LOCATION" 'Location of the Access dB
appAccess.Visible = False
Application.DisplayAlerts = False
appAccess.DoCmd.RunMacro "Mcro_DelTbls" 'Macro to delete the tables in Access dB
appAccess.DoCmd.SetOption "Auto Compact", True 'Compact and Repair after deleting data from tables
appAccess.DoCmd.RunMacro "Mcro_V2" 'Macro to run th
ActiveWorkbook.RefreshAll
appAccess.CloseCurrentDatabase
ActiveWorkbook.Activate
MsgBox "DONE", vbCritical
End Sub