Error 3343: Unrecognized database format 'C:\Temp\Northwind.accdb"

Anonymous
2013-05-20T14:58:48+00:00

I am tasked with connecting to an Access DB from a Word 2010 Macro.  I downloaded the Microsoft sample database and the sample verification code but that does not work either.  I can open the Access database so it does not appear to be corrupted.  Using the following VBA code it appears that I am able to find the database but not open it.

When I execute the following code I receive the Error 3343: Unrecognized database format 'C:\Temp\Northwind.accdb" on the line

                                                 Set dbNorthwind = OpenDatabase(Name:="C:\Temp\Northwind.accdb")

Since I am using Microsoft's sample Access DB and Sample code what am I doing wrong and how do I correct this issue. 

Thanks,

Sub UsingDAOWithWord()

 Dim docNew As Document

 Dim dbNorthwind As DAO.Database

 Dim rdShippers As Recordset

 Dim intRecords As Integer

 'Set docNew = Documents.Add

 Set dbNorthwind = OpenDatabase(Name:="C:\Temp\Northwind.accdb")

 Set rdShippers = dbNorthwind.OpenRecordset(Name:="Shippers")

 For intRecords = 0 To rdShippers.RecordCount - 1

 docNew.Content.InsertAfter Text:=rdShippers.Fields(1).Value

 rdShippers.MoveNext

 docNew.Content.InsertParagraphAfter

 Next intRecords

 rdShippers.Close

 dbNorthwind.Close

End Sub

Microsoft 365 and Office | Word | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments
Answer accepted by question author
Anonymous
2013-05-20T18:34:09+00:00

Make sure you have made a reference to the correct DAO library (in VBA, in Tools->References). The old one, for .mdb files only, has DAO in its name. For .accdb files you need the new one, which is called "Microsoft Office 12.0 Access database engine Object Library" (or 14.0, for Office 10).

Was this answer helpful?

40+ people found this answer helpful.
0 comments No comments

15 additional answers

Sort by: Most helpful
  1. Anonymous
    2013-05-21T16:49:25+00:00

    I had already swiched libraries to get that far.  Did not find much on line to help me either.

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2013-05-21T16:48:18+00:00

    Neither did I.

    Thanks

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2013-05-21T16:46:49+00:00

    Thanks, I discovered this by trial an error and some article I had found on line.

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2013-05-21T16:43:21+00:00

    Yes this reply was helpful.  I am now able to open the DB with this code.  However, I now get a run time error - type missmatch on the following statement:

     Set rdShippers = dbNorthwind.OpenRecordset(Name:="Shippers")

    Working that off now.  If you havce any thoughts let me know.

    thanks you have been very helpful.

    Was this answer helpful?

    0 comments No comments