Charlotte Foust
charlotte.foust at gmail.com
Mon Dec 10 11:53:57 CST 2012
If you simply get the DBEngine object you can then check the Version property of the object to see which version of Access you're dealing with. What exactly are you trying to achieve with this and how do the two functions relate to one another? Charlotte On Mon, Dec 10, 2012 at 9:12 AM, William Benson <vbacreations at gmail.com>wrote: > 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 >