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: Oldest
  1. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

  2. Jay Freedman 208.1K Reputation points Volunteer Moderator
    2013-05-20T18:56:32+00:00

    Thanks, Peter. I knew that lack of domain-specific knowledge was going to trip me.

    Oddly, not one of a dozen or so posts about that error message that I found mentioned anything about the different library reference.

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2013-05-20T20:13:57+00:00

    > Oddly

    Well, I wasn't certain that 3343 resulted from using the wrong library, but a similar problem came up elsewhere recently in http://answers.microsoft.com/en-us/office/forum/office_2010-customize/excel-database-question/529e5f07-1afe-461d-8489-b84856d5891b (I arrived late) and the library seemed a likely cause.

    Was this answer helpful?

    0 comments No comments
  4. Jay Freedman 208.1K Reputation points Volunteer Moderator
    2013-05-20T20:52:24+00:00

    Well, you are correct. When I switched libraries, the original code worked without any errors. We'll see whether Bill_PhD gets the same result.

    Was this answer helpful?

    0 comments No comments