bobdole22
New Member
- Joined
- Aug 28, 2013
- Messages
- 4
I am trying to run this code, I got from another thread on this forum that is closed. I'm sure it's been used a ton of times. It is supposed to link to an Access file and run it's macro.I have 2007, so my db files are ".accdb" if that changes anything. Here is the code:
VB:
Dim strDatabasePath As String Dim appAccess As Access.Application strDatabasePath = "C:\Users\zachk\Desktop\Strats 2011.01.accdb" Set appAccess = New Access.Application With appAccess Application.DisplayAlerts = False .OpenCurrentDatabase strDatabasePath .DoCmd.RunMacro "qry_MakeTrustTable_Adhoc" .Quit End With Set appAccess = Nothing </pre>
I am getting the error
User-defined Type not defined
on line:
Set appAccess = New Access.Application
VB:
Dim strDatabasePath As String Dim appAccess As Access.Application strDatabasePath = "C:\Users\zachk\Desktop\Strats 2011.01.accdb" Set appAccess = New Access.Application With appAccess Application.DisplayAlerts = False .OpenCurrentDatabase strDatabasePath .DoCmd.RunMacro "qry_MakeTrustTable_Adhoc" .Quit End With Set appAccess = Nothing </pre>
I am getting the error
User-defined Type not defined
on line:
Set appAccess = New Access.Application