Microsoft KB Archive/216152

-

The information in this article applies to:


 * Microsoft Visual C++, 32-bit Editions, version 6.0

-

SYMPTOMS
When opening an Access 2000-created database through MFC DAO classes in Visual C++, you get the following error message:

Unrecognized database format.

You also get this message when trying to create a new MFC DAO database SDI or MDI project using MFC AppWizard.

CAUSE
This error message occurs because the MFC DAO classes that ship with VC++ 6.0 load DAO 3.5 (Dao350.dll) by default. DAO 3.5 uses Jet 3.5, which can only open Jet 3.5 format (or earlier) databases. Access 2000 creates Jet 4.0-format database files, which are unrecognizable to Jet 3.5. To successfully open an Access 2000 database using the MFC DAO classes, you need to use DAO 3.6 (Dao360.dll). DAO 3.6 uses Jet 4.0, which can open any available format Access database.

RESOLUTION
For MFC 6.0 to load version 3.6 of DAO, you must update the version of MFC at run time to MFC version 6.01. This can be achieved by inserting the following line of code before you open an Access 2000 database:

AfxGetModuleState->m_dwVersion = 0x0601; Insert this line in the CYourApp::Initinstance function of your program. Currently, there is no workaround to use AppWizard with Access 2000 data sources.

NOTE: This resolution works only when MFC is linked dynamically to the application and not when it is linked statically.

STATUS
This behavior is by design.