From excel need to open access form or database


Posted by Laurinda Brundage on December 05, 2001 6:57 AM

We have created a program that is running excel. It reaches out to a database and gets information. This all works fine. There is a seperate procedure that currently runs in access that I want to be able to start from a command button in excel. The only reason is so that the user does not have to open the access database and run the procedure. I only want them to have to do everything from one place, is this possible? Any help would be great. Thanks

Posted by Ben on December 05, 2001 12:28 PM

Here's a simple routine that can be put in the click event of a command button in Excel....

Private Sub CommandButton1_Click()
Dim appAccess As Object
Set appAccess = CreateObject("Access.Application")
appAccess.OpenCurrentDatabase "[Insert database path]"
appAccess.DoCmd.RunMacro "[Insert macro name]"
Set appAccess = Nothing
End Sub



Posted by Laurinda on December 05, 2001 1:06 PM

Thanks for the help. I did try that piece of code and it does work to a point. It opens access and starts running the macro which is just opening a form that has a bunch of code behind it. It looks like it is trying to execute the next command in excel before the code in access is finished running. I also got a memory error at one point.