I am trying to write code that will open a database and run a macro from the database I currently have open. Here is the code I have written:
Dim db As DAO.Database
DoCmd.RunMacro "AppliQueryAll"
Set db = OpenDatabase("C:/2008 USDA/2008PSU/Arcview/ArcviewInfo.mdb")
DoCmd.RunMacro "AppliQueryPSU"
CloseCurrentDatabase
Set db = OpenDatabase("C:/2008 USDA/2008WRP/Arcview/ArcviewInfo.mdb")
DoCmd.RunMacro "AppliQueryWRP"
CloseCurrentDatabase
Quit
When I test the code I get the msg "Can't find macro AppliQueryPSU" which exists in the first database I am trying to open. I'm not sure but I think it is because it's being looked for in the original database instead of the one I'm opening. Any suggestions would be great. Thanks
Dim db As DAO.Database
DoCmd.RunMacro "AppliQueryAll"
Set db = OpenDatabase("C:/2008 USDA/2008PSU/Arcview/ArcviewInfo.mdb")
DoCmd.RunMacro "AppliQueryPSU"
CloseCurrentDatabase
Set db = OpenDatabase("C:/2008 USDA/2008WRP/Arcview/ArcviewInfo.mdb")
DoCmd.RunMacro "AppliQueryWRP"
CloseCurrentDatabase
Quit
When I test the code I get the msg "Can't find macro AppliQueryPSU" which exists in the first database I am trying to open. I'm not sure but I think it is because it's being looked for in the original database instead of the one I'm opening. Any suggestions would be great. Thanks