Solved

Roll Back Access 2013 app to Access 2007

Posted on 2013-12-26
5
1,075 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 34

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 34

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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

We were having a lot of "Heartbeat Alerts" in our SCOM environment, now "Heartbeat" in a SCOM environment for those of you who might not be familiar with SCOM is a packet of data sent from the agent to the management server on a regular basis, basic…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
The viewer will learn how to simulate a series of coin tosses with the rand() function and learn how to make these “tosses” depend on a predetermined probability. Flipping Coins in Excel: Enter =RAND() into cell A2: Recalculate the random variable…

757 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now