Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / September 2007

Tip: Looking for answers? Try searching our database.

running Access procedure from Excel

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
savalou - 14 Sep 2007 16:57 GMT
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
JW - 14 Sep 2007 19:16 GMT
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"
> Hello,
>
[quoted text clipped - 16 lines]
>
> Dave
savalou - 14 Sep 2007 19:30 GMT
> 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:
[quoted text clipped - 25 lines]
>
> - Show quoted text -

It's a sub procedure.

Thanks,

Dave
- - 14 Sep 2007 20:24 GMT
Works for me. Could this be a security issue where you need to enable macros
to be run? In Access 2003 I specifically have to click "Open" in a dialog
because it has code in it.

> Hello,
>
[quoted text clipped - 16 lines]
>
> Dave
savalou - 14 Sep 2007 20:45 GMT
> Works for me. Could this be a security issue where you need to enable macros
> to be run? In Access 2003 I specifically have to click "Open" in a dialog
[quoted text clipped - 22 lines]
>
> - Show quoted text -

I have the macros enabled.  This is working for me now.  I was getting
an error message, but it was actually peforming the sub routine, so I
put an 'On error resume next' before the appAcc.Run "getdata_Kenya" .
Still don't know what the error is all about.

thanks again for your time.

Dave
- - 14 Sep 2007 21:12 GMT
Looks like there's something in "getdata_Kenya" that's erroring out.
Possibly the error doesn't happen when you run it from Access, but just from
Excel?

>> Works for me. Could this be a security issue where you need to enable
>> macros
[quoted text clipped - 32 lines]
>
> Dave
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.