[AccessD] CreateObject ("Access.Application") is not working

Jim Dettman jimdettman at verizon.net
Mon Dec 10 12:56:53 CST 2012


 BTW, you should not be doing a CreateObject() on the DB engine.  It's a
property of the Access Application object.

Set objApp = obj.Application
Debug.Print objApp.DBEngine.version

If you really want multiple dbEngine objects (say for using multiple
workgroup files), then you want to use the PrivDBEngine object.
		
Jim. 

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of William Benson
Sent: Monday, December 10, 2012 12:12 PM
To: Access Developers discussion and problem solving
Subject: [AccessD] CreateObject ("Access.Application") is not working

I have a function that I cannot seem to get to create an instance of
microsoft access even though it is installed on my machine I am getting
error 429 which is "ActiveX component can't create object". I do have
references set to both DAO and Microsoft Access 14.0 but I think that is
irrelevant


Public Function GetDB(strLoc As String) As Object
Dim Ac As Object
Dim GetDBEngine As Object
Dim strName As String
On Error Resume Next
Set Ac = GetObject(, "Access.Application")
If Ac Is Nothing Then
    Set Ac = CreateObject("Access.Application")
End If

If Ac Is Nothing Then

Set GetDBEngine = CreateObject("DAO.DBEngine.120")
If Err.Number <> 0 Then 'try 36
  Err.Clear
  Set GetDBEngine = CreateObject("DAO.DBEngine.36")
  If Err.Number <> 0 Then
    Set GetDBEngine = CreateObject("DAO.DBEngine.35")
  End If
End If
If Not GetDBEngine Is Nothing Then
    Set GetDB = GetDBEngine.Workspaces(0).OpenDatabase(strLoc)
End If
End Function
-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com



More information about the AccessD mailing list