Convert mdb to accdb and vice versa (1 Viewer)

Gasman

Enthusiastic Amateur
Local time
Today, 12:39
Joined
Sep 21, 2011
Messages
14,305
Hi all,
Spotted this link in another forum and thought it might be useful to some.

This is basic, you need to amend it to make it more useful, but the logic applies.

What is strange is that I managed to comvert an accdb back to mdb, just as a test, but it opened fine?

Code is in the logic of my last test, accdb to mdb. Just reverse the string variables and choose the correct format. That even goes back to Access2 ?
Code:
Sub ConvertToACCDB()
  Dim src  As String
  Dim dst As String
 
  dst = "F:\Users\Paul\Documents\bibbys-converted.mdb"
  src = "F:\Temp\bibbys-Temp1.accdb"
 
  ConvertAccessProject src, dst, AcFileFormat.acFileFormatAccess2000
 
End Sub

Edit: Sorry, I should have mentioned, link was posted by @bastanu :(
 
Last edited:

jdraw

Super Moderator
Staff member
Local time
Today, 07:39
Joined
Jan 23, 2006
Messages
15,379
Paul,
Very interesting. I've not seen this before.
Running Access 365 and found it n the Object Browser.

Also, an M$oft link for Application.ConvertAccessProject

Convert_Paul.PNG
 

Minty

AWF VIP
Local time
Today, 12:39
Joined
Jul 26, 2013
Messages
10,371
Oooh - interesting!
 

theDBguy

I’m here to help
Staff member
Local time
Today, 04:39
Joined
Oct 29, 2018
Messages
21,473
My guess is that this method would still follow the same rules as the manual method. For instance, you can only up convert an A97 MDB using A2000 first before using A2007 to create an ACCDB. If it doesn't follow that process, then this would certainly be a great find, indeed. Cheers!
 

Gasman

Enthusiastic Amateur
Local time
Today, 12:39
Joined
Sep 21, 2011
Messages
14,305
My guess is that this method would still follow the same rules as the manual method. For instance, you can only up convert an A97 MDB using A2000 first before using A2007 to create an ACCDB. If it doesn't follow that process, then this would certainly be a great find, indeed. Cheers!
I suspect that would be the case, and I only have 2007.

However we know someone who has all the versions.?

Colin, @isladogs where are you? :) rofl
 
Last edited:

jdraw

Super Moderator
Staff member
Local time
Today, 07:39
Joined
Jan 23, 2006
Messages
15,379
Paul,

Just tried with CH05.mdb (Acc '97 file).
Error couldn't open the Acc'97 file.

As I recall, inability to open Acc '97 on my O365 was prime reason I asked you to
convert those older mdb files to accdb/2007.


Code:
Sub ConvertToACCDB_4Gasman()
    On Error GoTo ConvertToACCDB_4Gasman_Error
  Dim src  As String
  Dim dst As String

  dst = "c:\users\jp\Documents\CH05_converted.accdb"
  src = "c:\users\jp\downloads\ch05.mdb"

  ConvertAccessProject src, dst, AcFileFormat.acFileFormatAccess2007

   
    On Error GoTo 0
ConvertToACCDB_4Gasman_Exit:
    Exit Sub

ConvertToACCDB_4Gasman_Error:

    MsgBox "Error " & Err.Number & " (" & Err.Description & "), line " & Erl & " in Procedure ConvertToACCDB_4Gasman" _
   & "  Module  AWFRelated "
    GoTo ConvertToACCDB_4Gasman_Exit
End Sub

Here is result.
Paul_Err.PNG
 

isladogs

MVP / VIP
Local time
Today, 12:39
Joined
Jan 14, 2017
Messages
18,225
I suspect that would be the case, and I only have 2007.

However we know someone who has all the versions.?

Colin, @isladogs where are you? :) rofl
Hi
Yes I do have all the old and most of the new versions.
I tried this code a long time ago.
It has exactly the same limitations as converting manually. You can only do what the version you are using allows
 

Gasman

Enthusiastic Amateur
Local time
Today, 12:39
Joined
Sep 21, 2011
Messages
14,305
Paul,

Just tried with CH05.mdb (Acc '97 file).
Error couldn't open the Acc'97 file.

As I recall, inability to open Acc '97 on my O365 was prime reason I asked you to
convert those older mdb files to accdb/2007.


Code:
Sub ConvertToACCDB_4Gasman()
    On Error GoTo ConvertToACCDB_4Gasman_Error
  Dim src  As String
  Dim dst As String

  dst = "c:\users\jp\Documents\CH05_converted.accdb"
  src = "c:\users\jp\downloads\ch05.mdb"

  ConvertAccessProject src, dst, AcFileFormat.acFileFormatAccess2007

  
    On Error GoTo 0
ConvertToACCDB_4Gasman_Exit:
    Exit Sub

ConvertToACCDB_4Gasman_Error:

    MsgBox "Error " & Err.Number & " (" & Err.Description & "), line " & Erl & " in Procedure ConvertToACCDB_4Gasman" _
   & "  Module  AWFRelated "
    GoTo ConvertToACCDB_4Gasman_Exit
End Sub

Here is result.
View attachment 105756
Ah well, worth a try. :)
You never know, we might have discoved a hidden 'feature' :)
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 07:39
Joined
Feb 19, 2002
Messages
43,275
Is there any place to get a free runtime for A2K or A2007 from Microsoft? I've found other sites but I don't know if they are trustworthy. Over the years, some versions of the runtime were free and others were not. I think A2003 was not free. That would allow us to create a tool to convert A97 and older databases to newer versions. If A2007 can't read A2.0 then A2k would be better. If A2007 can read A2.0 then that would be best. I have a bunch of old files that I never converted because I thought MS would continue to support at least reading them.
 

Gasman

Enthusiastic Amateur
Local time
Today, 12:39
Joined
Sep 21, 2011
Messages
14,305
Pat,
If 2007 will convert them, I am more than happy to convert them for you.
 

isladogs

MVP / VIP
Local time
Today, 12:39
Joined
Jan 14, 2017
Messages
18,225
All versions of Access since A2000 up to and including A365 can still read and convert A2000 files.
A2007 was the last version that could handle A97 files.

Having said that, there is a utility that can extract the data from any version of Access from v1.0 onwards
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 07:39
Joined
Feb 19, 2002
Messages
43,275
Thanks for the offer. It is a real pain to get them all together. I was just going to run the convert on the whole drive and save the converted files to a new folder. Although there are basically Three high level folders that might contain databases but the conversion code could check the version and ignore newer databases and just convert the ones from A2.0 to A97. There's probably a few hundred and maybe a dozen would be useful or even interesting.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 07:39
Joined
Feb 19, 2002
Messages
43,275
I have some older than A97. Does A2007 handle them? At some point, Access could read old formats but not update them. That's fine I think as long as you are converting them.
 

Gasman

Enthusiastic Amateur
Local time
Today, 12:39
Joined
Sep 21, 2011
Messages
14,305
No idea. Send me one and I will find out.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 07:39
Joined
Feb 19, 2002
Messages
43,275
Thanks, they're on an old computer. I'll power it up and see what happens. I'm pretty sure it can read the A97 and I've converted most of those files but not the older ones. It has A2010 installed.
 

isladogs

MVP / VIP
Local time
Today, 12:39
Joined
Jan 14, 2017
Messages
18,225
A2007 can read/convert A95 & A97 files.
However, it cannot open/convert A2.0 or A1.0 files
 

Users who are viewing this thread

Top Bottom