Ms Access 2007 Error 429 ActiveX compenent can't create object

Hi all,

Any ideas why I'd get error 429  [ActiveX component can't create object] on

Dim appAccess As Access.Application

' Create instance of Access Application object.
Set appAccess = CreateObject("Access.Application")

Open in new window


Compiles fine, no broken references.

Many thanks!

K.
katerina-pAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jeffrey CoachmanMIS LiasonCommented:
Works fine for me...

What version of Access are you running this on?
Jeffrey CoachmanMIS LiasonCommented:
is that your "entire" code?

See here:
http://support.microsoft.com/kb/319844
katerina-pAuthor Commented:
Public Function fCallForeignProcedure(sDBPath As String, sProc As String, Optional sArgs1 As String, Optional sArgs2 As String)

Dim appAccess As Access.Application

' Create instance of Access Application object.
Set appAccess = CreateObject("Access.Application")

' Open MyDatabaseName.mdb database in Microsoft Access window.
appAccess.OpenCurrentDatabase sDBPath, False
'False so as not to open in exclusive mode
' Run Sub procedure.
Select Case Len(sArgs1)
  Case Is = 0
    appAccess.Run sProc
  Case Is > 0
    Select Case Len(sArgs2)
      Case Is = 0
        appAccess.Run sProc, sArgs1
      Case Is > 0
        appAccess.Run sProc, sArgs1, sArgs2
    End Select
End Select
appAccess.Quit
Set appAccess = Nothing
End Function

Open in new window


Running on Windows Svr 2008 R2, both Access 2007 and Access 2010 runtime. Actually I believe it's only started occurring since 2010 runtime was installed.
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

Jeffrey CoachmanMIS LiasonCommented:
AFAIK, CreateObject will not work in the Runtime

see here:
http://social.msdn.microsoft.com/Forums/office/en-US/ca69bcf6-e348-4054-9ff8-de7102bb848e/access-2010-runtime-error-on-createobjectaccessapplication
...for an explanation and a workaround.
katerina-pAuthor Commented:
None of the causes on http://support.microsoft.com/kb/319844 seem to be it.

K.
katerina-pAuthor Commented:
Thanks boag2000 - it's stopped working in the 2007 full version too though...?
katerina-pAuthor Commented:
Syscmd(acSysCmdRuntime) returns false, ?Syscmd(acSysCmdAccessVer) 12.0 [2007, right?]
Jeffrey CoachmanMIS LiasonCommented:
This works fine for me in Access 2007:

Dim dbAccess As DAO.Database
Set dbAccess = Application.DBEngine.CreateDatabase("C:\YourFolder\Newdatabase.accdb", dbLangGeneral)
katerina-pAuthor Commented:
I need to open an existing accdb, and run a sub in a module in it - perhaps passing up to two variables to that sub.

Thanks for your help.
Jeffrey CoachmanMIS LiasonCommented:
Hold on...
We are getting ahead of ourselves...

Your first question was why the code as failing.
I posted code that worked for me in Access 2007.
Dim dbAccess As DAO.Database
Set dbAccess = Application.DBEngine.CreateDatabase("C:\YourFolder\Newdatabase.accdb", dbLangGeneral)
...Did this code work for you in creating the database without error?  (as you originally asked)
Yes or No...
If yes, then your original question, as stated, is resolved.

If not, ... then explain what did, or did not happen when you ran the code I posted...


JeffCoachman
katerina-pAuthor Commented:
JeffCoachman - apologies - I thought I had prefixed my comment with "Yes, that does create a new db".

However, I didn't ask to create a new database.

Thanks

K.
Jeffrey CoachmanMIS LiasonCommented:
Not trying to be argumentative here, but your original question was:

<Any ideas why I'd get error 429  [ActiveX component can't create object] on:
Dim appAccess As Access.Application

' Create instance of Access Application object.
Set appAccess = CreateObject("Access.Application")

To which I replied that the code worked fine for me in my own sample code.

I then posted code that should have worked for you in Access 2007.

So can we clarify what your original question was, and what you were looking for as an answer?

JeffCoachman
katerina-pAuthor Commented:
Hi Jeff,

Well, no problem - and apologies if my question had ambiguity. I simply posted the line the error occurred on - the full function I posted above, and again below for reference.

The purpose of the code is to run a function in a different accdb. It has been working fine for years. The code you provided does indeed work at creating a new database. I didn't think my code could be used for that, so if I've used it wrong forgive me:


Dim appAccess As Access.Application
Set appAccess = CreateObject("Access.Application")
appAccess.OpenCurrentDatabase sDBPath, False
appAccess.Run sProc, sArgs1
appAccess.Quit
Set appAccess = Nothing

Open in new window


So: to be technically accurate, my question asked why [my presumption:] the installation
of Access 2010 runtime on Server 2008 would cause the error to occur on previously-fine code.

My actual problem is that I need to run subs in other accdbs, and sometimes pass variables to those subs.

Thanks

K.
Jeffrey CoachmanMIS LiasonCommented:
Prhaps it ran fine as an .mdb/.accdb file, but I don't think it is supported in the runtime... See here:
http://support.microsoft.com/kb/295179/en-us
("The CreateObject call is not supported in the run-time environment because the Access runtime requires a file to be supplied on the command line.")

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
katerina-pAuthor Commented:
It's failing on both the 2010 runtime, but also the 2007 full edition as an accdb
katerina-pAuthor Commented:
OK - the problem might be this:  the above code on 2007 full appears to be attempting to create the Access object using 2010. .accdbs are opened by Access2007 as default: where else would Access be getting the info to try and open 2010 instead of 2007?
Jeffrey CoachmanMIS LiasonCommented:
Ah, OK, ...not sure, as I have heard that you should try to avoid mixing Access versions and runtime versions...
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.