View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
savalou savalou is offline
external usenet poster
 
Posts: 9
Default running Access procedure from Excel

On Sep 14, 2:16 pm, JW wrote:
is "getdata_Kenya" the name of a query in your database? A module
name? A sub procedure name? If it's a query, you could use:
appAcc.DoCmd.OpenQuery "getdata_Kenya"

If a function, try this:
appAcc.DoCmd.OpenFunction "getdata_Kenya"



savalou wrote:
Hello,


I'm trying to run a procedure in access using excel VBA. I set the
access object library reference and ran this code but it hangs on the
appAcc.run command; Run-time error '440': Method 'Run' of object
'_Application' failed.


Sub GetKenyaAPRdata()
Dim appAcc As Access.Application
Set appAcc = New Access.Application
appAcc.Visible = False
appAcc.OpenCurrentDatabase ("C:\PMS\PEPFARresults.mdb")
appAcc.Run "getdata_Kenya"
appAcc.Quit
Set appAcc = Nothing
End Sub


Thanks in advance!


Dave- Hide quoted text -


- Show quoted text -


It's a sub procedure.

Thanks,

Dave