mattmickle
Board Regular
- Joined
- Nov 17, 2010
- Messages
- 81
OK,
Not sure if I'm explaining this right:
I have a fairly extensive, VBA heavy spreadsheet that requires weekly data updates.
From this worksheet, I would like to open the Access Database where the data resides, run one query and export those results, then export 3 complete tables as well.
Here's my code so far:
but it doesn't like the DoCmd when i run it. I'm using Excel 2007 and Access 2007.
Any help would be greatly appreciated.
Not sure if I'm explaining this right:
I have a fairly extensive, VBA heavy spreadsheet that requires weekly data updates.
From this worksheet, I would like to open the Access Database where the data resides, run one query and export those results, then export 3 complete tables as well.
Here's my code so far:
Code:
Option Explicit
Sub CHANGE_FORM_EXPORTS()
On Error GoTo CHANGE_FORM_EXPORTS_Err
Dim MyAccess As Object
Set MyAccess = CreateObject("Access.Application")
MyAccess.Visible = True
MyAccess.OpenCurrentDatabase ("[URL="file://\\golub.com\depts\HR-Share\Salary"]\\golub.com\depts\HR-Share\Salary[/URL] Admin\Salary.mdb")
Application.DisplayAlerts = False
DoCmd.OpenQuery "CHANGE_FORMS_2014"
DoCmd.Close acQuery, "CHANGE_FORMS_2014"
DoCmd.RunSavedImportExport "Export-CHANGE_FORMS_2014"
DoCmd.OpenTable "Job Table - With Areas - CURRENT"
DoCmd.Close acTable, "Job Table - With Areas - CURRENT"
DoCmd.RunSavedImportExport "Export-Job Table - With Areas - CURRENT"
DoCmd.OpenTable "Store Supervisors"
DoCmd.Close acTable, "Store Supervisors"
DoCmd.RunSavedImportExport "Export-Store Supervisors"
DoCmd.OpenTable "Combined Supervisors Table"
DoCmd.Close acTable, "Combined Supervisors Table"
DoCmd.RunSavedImportExport "Export-Combined Supervisors Table"
CHANGE_FORM_EXPORTS_Exit:
Exit Sub
CHANGE_FORM_EXPORTS_Err:
MsgBox Error$
Resume CHANGE_FORM_EXPORTS_Exit
Application.DisplayAlerts = True
End With
End Sub
but it doesn't like the DoCmd when i run it. I'm using Excel 2007 and Access 2007.
Any help would be greatly appreciated.