# Thread: Getting "Unrecognized database format" error when opening old MDB with DAO

1. ## Getting "Unrecognized database format" error when opening old MDB with DAO

Hi all,
We've searched and can't find the answer for our problem. The actual error message is attached below. But using the same MDB file and same VB exe app, some computers will produce the error, but others will not! By the way, these computers are *all* Win 7 64 bit! Also some Win XP computers do not produce the error, again on the same database and same VB6 exe. Our current MDB databases open fine it's only when we try to read older MDB files that we see this issue. But again only on some computers, not all.

Basically we have a VB6 DAO project that reads and writes to MDB files. We suspect the problem originated around the time that we migrated to DAO 3.6 and replaced the CreateDatabase function with a FileCopy from an empty MDB file, in preparation for converting to ADO (which we never actually did). The new MDB files copied from the "template" MDB work fine on all computers. It's just the old MDB files that were we think were created with CreateDatabase, that are a problem we think- but not 100% sure.

Also on those computers where the error is produced, it's not the first query of the database, it's actually the second that fails, so this code works fine:

Set FiDb = OpenDatabase(tfilename$, DatabaseNonExclusiveAccess%, dbReadOnly) Set FiDt = FiDb.OpenRecordset("File", dbOpenSnapshot) Then this next code produces the unrecognized database format error: Set PrDb = OpenDatabase(tfilename$, ProbeDatabaseNonExclusiveAccess%, dbReadOnly)
Set PrRs = PrDb.OpenRecordset("Sample", dbOpenTable)

Does anyone know about this issue? We would really appreciate some expert help. We could provide more information and/or a sample file of the older database format if necessary.

2. ## Re: Getting "Unrecognized database format" error when opening old MDB with DAO

Gosh, I'm a little surprised that no one has responded to my "Unrecognized database format" error questions.

Am I not providing enough information? What can I do to help?

3. ## Re: Getting "Unrecognized database format" error when opening old MDB with DAO

Should I attach an example of the database that causes the error?

4. ## Re: Getting "Unrecognized database format" error when opening old MDB with DAO

Have you Googled something like "access database unrecognized database format error" lots of info.

Have you done a Compact and Repair?

5. ## Re: Getting "Unrecognized database format" error when opening old MDB with DAO

Are all office installations the 32 bit?
Check the references on one that works and one that doesnt to see if there is another problem; may be one is using an older ado/dao than the others?
Is it only when opening the table (might be read only access being a problem - but doubt it if some work and some dont)

6. ## Re: Getting "Unrecognized database format" error when opening old MDB with DAO

Yes, and got many hits, but nothing I found seemed relevant. I also tried opening the MDB in Access and doing a compact/repair, but that didn't help either.

Again, the odd thing is that the same MDB and same app exe behaves differently on different computers so I'm assuming it's a library issue.

7. ## Re: Getting "Unrecognized database format" error when opening old MDB with DAO

You mean Microsoft Office? Yes, they are all 32 bit, but this is not using Microsoft Office. This is just using DAO and VB6.

8. ## Re: Getting "Unrecognized database format" error when opening old MDB with DAO

Here's another clue. I tried replacing the dbOpenTable parameter with a dbOpenSnapShot parameter and I get the same unrecognized database format error.

Odd since the dbOpenSnapShot parameter works for the "File" table, but not for the "Sample" table. One difference is that the Sample table has an index I guess, but how that relates to this error I have no idea.

9. ## Re: Getting "Unrecognized database format" error when opening old MDB with DAO

Are the mdb-files all pure local Databases, or just kind of frontends to a backend on a server (with linked tables?)?

10. ## Re: Getting "Unrecognized database format" error when opening old MDB with DAO

Have you tried closing your connections/recordsets to your database before opening another one? Or have you tried opening just a single connection to the database? It's been a while (years) since I last used DAO so these are just stabs in the dark.

11. ## Re: Getting "Unrecognized database format" error when opening old MDB with DAO

Originally Posted by Zvoni
Are the mdb-files all pure local Databases, or just kind of frontends to a backend on a server (with linked tables?)?
Yes, these are all local MDB files.

I should also add that I also tried opening the "Sample" table with an dbOpenSnapshot keyword (which works with the "File" table, and I still get the unrecognized database format error.

12. ## Re: Getting "Unrecognized database format" error when opening old MDB with DAO

Originally Posted by dee-u
Have you tried closing your connections/recordsets to your database before opening another one? Or have you tried opening just a single connection to the database? It's been a while (years) since I last used DAO so these are just stabs in the dark.
Yes, I always close connections before opening another one. It's the same code, it just behaves differently with old vs. new MDB files.

13. ## Re: Getting "Unrecognized database format" error when opening old MDB with DAO

OK, I attached an example MDB file that causes the "unrecognized database format": error when opening the "Sample" table (but not on the "File" table), and was able to upload it by zipping it up.

So this is an older MDB file which was created using the CreateDatabase DAO function, and causes the "unrecognized database format" error on connecting to the *second* "Sample" table. Opening the "File" table does cause this error. The "Sample" table is also different in that it has more than one record and has an index.

As I explained in my first post :

Basically we have a VB6 DAO project that reads and writes to MDB files. We suspect the problem originated around the time that we migrated to DAO 3.6 and replaced the CreateDatabase function with a FileCopy from an empty MDB file, in preparation for converting to ADO (which we never actually did). The new MDB files copied from the "template" MDB work fine on all computers. It's just the old MDB files that were we think were created with CreateDatabase, that are a problem we think- but not 100% sure.

14. ## Re: Getting "Unrecognized database format" error when opening old MDB with DAO

Didn't test it with VB6, used VB .Net and ADO .Net but got the same error. Opened the file in MS Access and noticed it was Access 95 file format. Used the "Save & Publish" function and saved the db in Access 2000 Database format and it solved the problem.

15. ## Re: Getting "Unrecognized database format" error when opening old MDB with DAO

This just works fine here, without "repairing" or doing anything with your database. I just renamed your database to "database".
Code:
Dim conn As Database
Dim rsFiles As Recordset

Set conn = DBEngine.Workspaces(0).OpenDatabase(App.Path & "\database.mdb", False, True)

Set rsFiles = conn.OpenRecordset("File")

MsgBox rsFiles.RecordCount

MsgBox rsSample.RecordCount

16. ## Re: Getting "Unrecognized database format" error when opening old MDB with DAO

Originally Posted by wes4dbt
Didn't test it with VB6, used VB .Net and ADO .Net but got the same error. Opened the file in MS Access and noticed it was Access 95 file format. Used the "Save & Publish" function and saved the db in Access 2000 Database format and it solved the problem.
OK, that is very interesting information. Thank-you!

Is there a way to use the DAO API to detect the MDB version number and "save and publish" to the more recent MDB version without using MS Access?

17. ## Re: Getting "Unrecognized database format" error when opening old MDB with DAO

Originally Posted by dee-u
This just works fine here, without "repairing" or doing anything with your database. I just renamed your database to "database".
Code:
Dim conn As Database
Dim rsFiles As Recordset

Set conn = DBEngine.Workspaces(0).OpenDatabase(App.Path & "\database.mdb", False, True)

Set rsFiles = conn.OpenRecordset("File")

MsgBox rsFiles.RecordCount

MsgBox rsSample.RecordCount
Yes, I believe you. Opening the file works just fine on some computers, but not others. Using the same VB6 app!

I think wes4dbt has found the issue. For some reason, the DAO version on some computers can handle the older Access 95/97 format but some computers cannot.

What's really weird is that I used to be able to open these older files using DAO on my devel computer, but not any more. I wish I knew what changed...

18. ## Re: Getting "Unrecognized database format" error when opening old MDB with DAO

I wish I knew what changed...
Probably the DAOxxx.dll - check the versions you have installed (DAO360.dll, DAO350.dll, 32/64 bit, etc.).

19. ## Re: Getting "Unrecognized database format" error when opening old MDB with DAO

Not sure you can say it has anything to do with the DAO library. I go the error and I use ADO .Net, not DAO. Maybe DAO is involved some how when using Oledb, just don't know. I don't know why you would want to continue to use an Access 95 database. Is this db already on hundreds of machines or something.

20. ## Re: Getting "Unrecognized database format" error when opening old MDB with DAO

jdc2000 and wes4dbt,
Thanks, I think you've both got me on the right track now. I really appreciate it.

To answer wes4dbt's question about why keep supporting Access 95 MDB files, it's because these are old scientific data that have to remain accessible for as long as absolutely possible. The new databases are Access 2000 format so should be OK for a while using DAO360.

My mistake was thinking that the DAO360.DLL would be backwards compatible with the older MDB files, but apparently one still needs the DAO350.DLL installed on the system in order to read the older MDB formats.

What I think happened was that in my WIX installer script, after I started using DAO360, I thought I didn't need to install the DAO350 stuff anymore, so I commented that installer code out. I think I assumed that one couldn't have DAO350 and DAO360 both installed on a computer, but I now realize that is probably where I went wrong. I will try uncommenting the DAO350 installer script code and see if that helps the problem of reading these older MDB formats...

Does that make sense to you all?

21. ## Re: Getting "Unrecognized database format" error when opening old MDB with DAO

To answer wes4dbt's question about why keep supporting Access 95 MDB files, it's because these are old scientific data that have to remain accessible for as long as absolutely possible. The new databases are Access 2000 format so should be OK for a while using DAO360
What I meant was why not convert the old 95 format db's to 2000-2003 format.

22. ## Re: Getting "Unrecognized database format" error when opening old MDB with DAO

Originally Posted by wes4dbt
What I meant was why not convert the old 95 format db's to 2000-2003 format.
Ah, OK. It's because these old format MDB file are in labs scattered around the world. No way I can get access to all of them.

That is mainly why I asked if there was any way to convert the MDB files from the Access 97 format to the Access 2000 format using just DAO code.

23. ## Re: Getting "Unrecognized database format" error when opening old MDB with DAO

Originally Posted by John Donovan
My mistake was thinking that the DAO360.DLL would be backwards compatible with the older MDB files, but apparently one still needs the DAO350.DLL installed on the system in order to read the older MDB formats.

What I think happened was that in my WIX installer script, after I started using DAO360, I thought I didn't need to install the DAO350 stuff anymore, so I commented that installer code out. I think I assumed that one couldn't have DAO350 and DAO360 both installed on a computer, but I now realize that is probably where I went wrong. I will try uncommenting the DAO350 installer script code and see if that helps the problem of reading these older MDB formats...

Does that make sense to you all?
Well, I have DAO360 and it is working with the Access database you attached.

24. ## Re: Getting "Unrecognized database format" error when opening old MDB with DAO

Hi dee-u,
I completely believe you. I see the same thing myself on some computers.

On some computers my DAO360 code works fine and on other computers my DAO360 code gives the "unrecognized database format" error.

My current theory is that some computers already had DAO350 installed, and some did not. The ones that have DAO350 previously installed work fine, those without the DAO350 can't open the older MDB files- at least for the "Sample" table.

I suspect that DAO350 is already installed on your computer and so it invokes it automatically for the older format MDB file.

But here's a question for all: I found that my installer script which used to install the DAO350 dll, also installed a file named VB5DB.DLL. The properties dialog says "Visual Basic ICursor Interface library". Does anyone know if this file is needed by the DAO350 library?

25. ## Re: Getting "Unrecognized database format" error when opening old MDB with DAO

Originally Posted by John Donovan
That is mainly why I asked if there was any way to convert the MDB files from the Access 97 format to the Access 2000 format using just DAO code.
Hi,
just create a empty Access2000 DB and then select from there Import Tables, select the Access97 Database,
then select all Tables with the Structure and Data

this is a guess but give it a try, I can't test it as I don't have a Access97 mdb

open Powershell and enter this
Code:
$Access = New-Object -com Access.Application$Access.ConvertAccessProject(
"E:\my97.mdb",
"E:\to2000.mdb",
"acFileFormatAccess2000")
$Access.Quit() 26. ## Re: Getting "Unrecognized database format" error when opening old MDB with DAO Originally Posted by ChrisE Hi, just create a empty Access2000 DB and then select from there Import Tables, select the Access97 Database, then select all Tables with the Structure and Data this is a guess but give it a try, I can't test it as I don't have a Access97 mdb open Powershell and enter this Code: $Access = New-Object -com Access.Application
$Access.ConvertAccessProject( "E:\my97.mdb", "E:\to2000.mdb", "acFileFormatAccess2000")$Access.Quit()
I appreciate the suggestion, but I can already convert Access 97 MDB files to Access 2000 using Access (see above post for an example of a Access 97 MDB file), and now with your suggestion also from Powershell, but what I was really asking is if there is a way to do the database version conversion from VB6 code.

The idea being that from my app I could detect the older format database, convert it and then be good to open it with DAO360.
john

27. ## Re: Getting "Unrecognized database format" error when opening old MDB with DAO

try this way, open a new VB6 project

Code:
'set Ref. to : Microsoft Jet and Replication Objects 2.6 Library

Option Explicit

Private Sub Command1_Click()
Dim oJro As JRO.JetEngine
Dim cnn1 As String, cnn2 As String
Set oJro = New JRO.JetEngine

'convert Access 97
cnn1 = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Jet OLEDB:Engine Type = 4;" & _

'to Access 2000
cnn2 = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data source=E:\base2000.mdb;" & _
"Jet OLEDB:Engine Type = 5;" & _

'Compact
oJro.CompactDatabase cnn1, cnn2
End Sub
regards
Chris

28. ## Re: Getting "Unrecognized database format" error when opening old MDB with DAO

Originally Posted by ChrisE
try this way, open a new VB6 project

Code:
'set Ref. to : Microsoft Jet and Replication Objects 2.6 Library

Option Explicit

Private Sub Command1_Click()
Dim oJro As JRO.JetEngine
Dim cnn1 As String, cnn2 As String
Set oJro = New JRO.JetEngine

'convert Access 97
cnn1 = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Jet OLEDB:Engine Type = 4;" & _

'to Access 2000
cnn2 = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data source=E:\base2000.mdb;" & _
"Jet OLEDB:Engine Type = 5;" & _

'Compact
oJro.CompactDatabase cnn1, cnn2
End Sub
regards
Chris
Holy crap, this is amazing! Cool. Thank-you!

But I have share something weird that just occurred this morning: I decided to add back into my WIX script the DAO350.dll and VB5DB.dll and merge files into my installer, thinking/hoping that when I removed those lines a few years ago, that must be what caused the problems with reading the older MDB files that I recently ran into.

But... this morning before I started to edit the WIX script, I ran my app and once again tried to load an older MDB file, and "lo and behold" it loaded OK!

I can't believe it. I didn't do anything. The only thing that happened is that last night Microsoft update ran and I see that it installed about 50 updates, all for Microsoft Office.

Could these updates have "repaired" DAO350?????

29. ## Re: Getting "Unrecognized database format" error when opening old MDB with DAO

Ok, this is also weird.

I modified my WIX script and added back in the DAO350 merge modules, DAO350.DLL and VB5DB.DLL. The DAO360 stuff is still there also. I then compiled a new MSI installer (no msi compile errors) and tried it on a computer that has been giving me the "unrecognized database format" error on the older MDB files. And dang it, I'm still getting the "unrecognized database format" error!

Now I'm really confused. I had thought that putting the old DAO350 code and files back in the installer script would fix this. And to complicate things, my devel computer can now read these older MDB file just fine since the Microsoft Office update last night.

How am supposed to interpret all this?

30. ## Re: Getting "Unrecognized database format" error when opening old MDB with DAO

Ok, so I tried my modified installer with DAO350 added back in on yet another computer, and again it didn't help! Just like my devel computer. Still got the "unrecognized database format" error with that Access 97 MDB file.

But, there was a Windows update pending on this 2nd computer, so I did a shutdown and after the Windows update and the computer re-booted, guess what? I was able to open the Access 97 MDB no problem with my existing app!

This was a major Microsoft Office update (over 50 KB references), so I'm just wondering: did Microsoft break something a while ago regarding Access 97 databases, and then just now, release an update to fix it? That all this has absolutely nothing to do with my installer?

I've seen this behavior on two different (Win 7 64) computers, so I'm just sayin'... what the heck is going on here?

31. ## Re: Getting "Unrecognized database format" error when opening old MDB with DAO

Have you seen this https://www.devhut.net/2019/01/12/ac...tabase-format/

Sooner or later (I'd suggest sooner) your going to have to update those old databases, that's a 20+ year old file format. They may be shatter all over but if your planning on supporting them for several more years then the update needs to be done. My guess is you be running into more and more of these types of problems.

32. ## Re: Getting "Unrecognized database format" error when opening old MDB with DAO

Originally Posted by wes4dbt
Have you seen this https://www.devhut.net/2019/01/12/ac...tabase-format/

Sooner or later (I'd suggest sooner) your going to have to update those old databases, that's a 20+ year old file format. They may be shatter all over but if your planning on supporting them for several more years then the update needs to be done. My guess is you be running into more and more of these types of problems.
Ha! Thanks. That link nails it- it's nothing I did.

The good news is that the latest Microsoft Office update that seems to be rolling out this week seems to fix the issue!

But I will alert my users that they can use Access 2010 to convert their old Access 97 databases to the Access 2000 format.

Thanks for all your help. Really appreciate this.

33. ## Re: Getting "Unrecognized database format" error when opening old MDB with DAO

Originally Posted by wes4dbt
Have you seen this https://www.devhut.net/2019/01/12/ac...tabase-format/

Sooner or later (I'd suggest sooner) your going to have to update those old databases, that's a 20+ year old file format. They may be shatter all over but if your planning on supporting them for several more years then the update needs to be done. My guess is you be running into more and more of these types of problems.
+1 to that

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•

Featured