2
votes

I have the follow VBA code which I use to connect to a MDB data base but I am getting a 429 error when I try to connect DAO.OpenDatabase(DbFile)

I was not getting this error before but now it is happening. On my other computer this connection works fine.

I checked the path of MDB and it is correct.

The references I am using are:
- Visual Basic for Applications
- Microsoft Excel 15.0 Object Library
- OLE Automation
- Microsoft Office 15.0 Object Library
- Microsoft DAO 3.6 Object Library

I am using Excel 2013 (in other computer is Excel 2010) but as I said it was working before on 2013.

Does anyone knows how to get this problem solved, please?

Private Sub IniciaDB()

Dim rs As Recordset
Dim fld As Variant
Dim DbFile as String

DbFile = "D:\Documentos\PMbox\PPMdatabase2.MDB"

On Error Resume Next
Set OpenConn = DAO.OpenDatabase(DbFile)
If Err.Number = 3024 Then MsgBox "Check connection string in the VBA StaticClass object", vbOKOnly

Set ObjAccess = CreateObject("Access.Application")
ObjAccess.Visible = False
ObjAccess.OpenCurrentDatabase (DbFile)

'runSQL ("INSERT INTO tabela_teste VALUES ('My name', 34)")
Set rs = runCursorSQL("SELECT * FROM tabela_teste")

Do While Not rs.EOF
    For Each fld In rs.Fields
        Debug.Print fld.Value & ";";
    Next
    rs.MoveNext
Loop

closeResources

End Sub
4
What line throws this error? What is the error description?shahkalpesh
The line is: Set OpenConn = DAO.OpenDatabase(DbFile)Braulio
The error description is: "ActiveX component can't create object"Braulio
I might suggest you to use a lower version of DAO library. It is likely that another machine has necessary things installed to be able to open MDB whereas this one might not. Does your machine have similar version of MS-Access on both machines?shahkalpesh
There is no other DAO version to select. I just removed the DAO reference and then I added it again, when I add I got a error "Error in loading DLL (Error 48)" it seems that the DAO DLL has a problem in my computer :/Braulio

4 Answers

2
votes

I had been struggling with the same issue for quite a long time.
It turned out that my Office was 64bit and so the referenced Microsoft DAO 3.6 Object Library didn't work.

Playing around with the references, it turned out that using Microsoft Office 15.0 Access database engine Object (ACEDAO.DLL) instead of the DAO360 solved the issue.

Link to a similar answer that would have solved my issue if I found it sooner Writing Excel VBA to receive data from Access

1
votes

I was building a MDB to ACCDB converter when I ran into the Error 429. Here is a link to the download that solved my problem.

http://www.microsoft.com/en-ca/download/details.aspx?id=13255

Quote: "This download will install a set of components that can be used to facilitate transfer of data between 2010 Microsoft Office System files and non-Microsoft Office applications."

0
votes

Well, the solution found is that the DAO reference was missing, it is in my computer but the reference indicates to Program Files and DAO is actually on Program Files (x86)

0
votes

I spent a night over this problem, until I finally fixed it by uninstalling the 64-bit versions of both MS Office and MS Access 2010 Redistributable and then re-installing the 32-bit version of both of them.

It definitely seems to me that the 64-bit builds have compatibility issues with this use of DAO.

I described the whole issue I had in this blog post.