psulions83
Board Regular
- Joined
- Nov 16, 2015
- Messages
- 127
Hi,
Is there a way with the below code to use a simple line to access my access file. The access file is in the same location as the Excel workbook I am running this from and will always have the same filename. The below works as is. I just want to be able to copy this into new locations and not update the code each time. Any help would be much appreciated.
Sub delete()
Dim appAccess As Access.Application
Set appAccess = New Access.Application
appAccess.OpenCurrentDatabase "C:\Access\Database1.accdb"
appAccess.Visible = True
Application.DisplayAlerts = False
appAccess.DoCmd.RunMacro "Mcro_DelTbls" 'Macro to delete the tables in Access dB
MsgBox "Delete Tables Complete. Compact & Repair Database in Access", vbCritical
End Sub
Is there a way with the below code to use a simple line to access my access file. The access file is in the same location as the Excel workbook I am running this from and will always have the same filename. The below works as is. I just want to be able to copy this into new locations and not update the code each time. Any help would be much appreciated.
Sub delete()
Dim appAccess As Access.Application
Set appAccess = New Access.Application
appAccess.OpenCurrentDatabase "C:\Access\Database1.accdb"
appAccess.Visible = True
Application.DisplayAlerts = False
appAccess.DoCmd.RunMacro "Mcro_DelTbls" 'Macro to delete the tables in Access dB
MsgBox "Delete Tables Complete. Compact & Repair Database in Access", vbCritical
End Sub
Last edited: