Solved

Roll Back Access 2013 app to Access 2007

Posted on 2013-12-26
5
1,139 Views
Last Modified: 2014-01-09
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
0
Comment
Question by:dgravitt
  • 3
  • 2
5 Comments
 
LVL 36

Expert Comment

by:PatHartman
ID: 39740453
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

0
 

Author Comment

by:dgravitt
ID: 39740488
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?
0
 
LVL 36

Accepted Solution

by:
PatHartman earned 500 total points
ID: 39740547
Here's the code to import a single form.
Public Sub ImportForm()
Dim strPath As String
    strPath = "C:\Data\Work\Form_"
    Application.Application.LoadFromText acForm, "frmLogDrawings", strPath & "frmLogDrawingsBAD" & ".txt"
End Sub

Open in new window

It is the bulk import I don't have handy.  You can take this and extrapolate it into a bulk import.

I think the only way you'll discover the a2013 features is when the import for the object fails so be sure to include good error trapping.
0
 

Author Comment

by:dgravitt
ID: 39751066
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.
0
 

Author Closing Comment

by:dgravitt
ID: 39769190
Thanks for the help!
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Having trouble getting your hands on Dynamics 365 Field Service or Project Service trial? Worry No More!!!
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question