Link to home
Start Free TrialLog in
Avatar of dgravitt
dgravittFlag for United States of America

asked on

Roll Back Access 2013 app to Access 2007

I have an Access 2013 application that needs to be converted back to Access 2007. The application was originally in 2007. When trying to import the objects from 2013 to 2007, Access 2007 does not recognize the 2013 database. From 2013, I can export one object at a time, but this is very time consuming. In the 2013 database, I tried writing a function to export all objects at once, but it doesn't work. Below is that function. Any help with the function, or other ideas to roll back would be appreciated.

Function Export_2007()
DoCmd.TransferDatabase acExport, "Microsoft Access", , "c:\client_db\clients.accdb", , "C:\Users\Don\Documents\client_new.accdb", False
End Function
Avatar of PatHartman
PatHartman
Flag of United States of America image

The database formats are the same so if A2007 doesn't recognize the database, it is because you have used A2013 features and won't be able to transfer them in any event.  I have a procedure I use when I am trying to fix corruption.  It exports everything to text files.  You can then write a procedure to re-import them.  I don't have that one with me.

Public Sub ExportDatabaseObjects(ExportType As String)
On Error GoTo Err_ExportDatabaseObjects
    
    'Dim db As Database
    Dim db As DAO.Database
    Dim td As DAO.TableDef
    Dim D As Document
    Dim C As Container
    Dim i As Integer
    Dim sExportLocation As String
    
    Set db = CurrentDb()
''import from text =
''application.Application.LoadFromText acForm, "frmRisks","C:\Temp\TextRiskReview070615\Form_frmRisks.txt"


    sExportLocation = "C:\Data\Work\Maggio\TextObjects\" 'Do not forget the closing back slash! ie: C:\Temp\
    
    Select Case ExportType
        Case "TableDefs"
            For Each td In db.TableDefs 'Tables
                If Left(td.Name, 4) <> "MSys" Then
                    DoCmd.TransferText acExportDelim, , td.Name, sExportLocation & "Table_" & td.Name & ".txt", True
                End If
            Next td
        Case "Forms"
            Set C = db.Containers("Forms")
            For Each D In C.Documents
                Application.SaveAsText acForm, D.Name, sExportLocation & "Form_" & D.Name & ".txt"
            Next D
        Case "Reports"
            Set C = db.Containers("Reports")
            For Each D In C.Documents
                Application.SaveAsText acReport, D.Name, sExportLocation & "Report_" & D.Name & ".txt"
            Next D
        Case "Scripts"
            Set C = db.Containers("Scripts")
            For Each D In C.Documents
                Application.SaveAsText acMacro, D.Name, sExportLocation & "Macro_" & D.Name & ".txt"
            Next D
        Case "Modules"
            Set C = db.Containers("Modules")
            For Each D In C.Documents
                Application.SaveAsText acModule, D.Name, sExportLocation & "Module_" & D.Name & ".txt"
            Next D
        Case "QueryDefs"
            For i = 0 To db.QueryDefs.Count - 1
                Application.SaveAsText acQuery, db.QueryDefs(i).Name, sExportLocation & "Query_" & db.QueryDefs(i).Name & ".txt"
            Next i
        Case Else
    End Select

    Set db = Nothing
    Set C = Nothing
    
    MsgBox "All database objects have been exported as a text file to " & sExportLocation, vbInformation
    
Exit_ExportDatabaseObjects:
    Exit Sub
    
Err_ExportDatabaseObjects:
    MsgBox Err.Number & " - " & Err.Description
    Resume Exit_ExportDatabaseObjects
    
End Sub

Open in new window

Avatar of dgravitt

ASKER

thanks, I'll run this. When you get to the import procedure, it would be appreciated. I need the queries and modules the most. Is there a way to discovery which objects have 2013 features?
ASKER CERTIFIED SOLUTION
Avatar of PatHartman
PatHartman
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Sorry I haven't been able to work on this during the holidays. Hope to try these suggestions within the next few days. Thanks for the suggestions.
Thanks for the help!