Link to home
Start Free TrialLog in
Avatar of katerina-p
katerina-p

asked on

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.
Avatar of Jeffrey Coachman
Jeffrey Coachman
Flag of United States of America image

Works fine for me...

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

See here:
http://support.microsoft.com/kb/319844
Avatar of katerina-p
katerina-p

ASKER

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.
None of the causes on http://support.microsoft.com/kb/319844 seem to be it.

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

Dim dbAccess As DAO.Database
Set dbAccess = Application.DBEngine.CreateDatabase("C:\YourFolder\Newdatabase.accdb", dbLangGeneral)
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.
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
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.
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
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.
ASKER CERTIFIED SOLUTION
Avatar of Jeffrey Coachman
Jeffrey Coachman
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
It's failing on both the 2010 runtime, but also the 2007 full edition as an accdb
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?
Ah, OK, ...not sure, as I have heard that you should try to avoid mixing Access versions and runtime versions...