Re: How To Rebuild Objects From Text Files?



On May 9, 5:11 am, Wayne <cqdigi...@xxxxxxxxxxxxxxx> wrote:
I've read that one method of repairing a misbehaving database is to
save all database objects as text and then rebuild them from the text
files.  I've used the following code posted by Lyle Fairfield to
accomplish the first step:

Private Sub SaveObjectsAsText()
    path = CurrentProject.path & "\ObjectsAsText\"
    SaveDataAccessPagesAsText
    SaveFormsAsText
    SaveReportsAsText
    SaveModulesAsText
    MsgBox "All Done Saving Access Objects as Text"
End Sub

Private Sub SaveDataAccessPagesAsText()
    Dim FileName As String
    Dim Name As String
    Dim DataAccessPage As AccessObject
    For Each DataAccessPage In CurrentProject.AllDataAccessPages
        Name = DataAccessPages.Name
        FileName = path & Name & Format(Now(), "yyyymmddhhnn") &
".txt"
        SaveAsText acDataAccessPage, Name, FileName
    Next DataAccessPage
MsgBox "All Done Saving Data Access Pages as Text"
End Sub

Private Sub SaveFormsAsText()
    Dim FileName As String
    Dim Name As String
    Dim Form As AccessObject
    For Each Form In CurrentProject.AllForms
        Name = Form.Name
        FileName = path & Name & Format(Now(), "yyyymmddhhnn") &
".txt"
        SaveAsText acForm, Name, FileName
    Next Form
MsgBox "All Done Saving Forms as Text"
End Sub

Private Sub SaveReportsAsText()
    Dim FileName As String
    Dim Name As String
    Dim Report As AccessObject
    For Each Report In CurrentProject.AllReports
        Name = Report.Name
        FileName = path & Name & Format(Now(), "yyyymmddhhnn") &
".txt"
        SaveAsText acReport, Name, FileName
    Next Report
MsgBox "All Done Saving Reports as Text"
End Sub

Private Sub SaveModulesAsText()
    Dim FileName As String
    Dim Name As String
    Dim Module As AccessObject
    For Each Module In CurrentProject.AllModules
        Name = Module.Name
        FileName = path & Name & Format(Now(), "yyyymmddhhnn") &
".txt"
        SaveAsText acModule, Name, FileName
    Next Module
MsgBox "All Done Saving Modules as Text"
End Sub

How do I then rebuild the database objects from the text files that
have been created?

Did I ever post this half-page? The whole pages can be found at:

http://www.ffdba.com/downloads/Save_MDB_Objects_As_Text.htm
or
http://www.ffdba.com/downloads/Save_ADP_Objects_As_Text.htm

http://www.ffdba.com/downloads/Save_MDB_Objects_As_Text.dat
or
http://www.ffdba.com/downloads/Save_ADP_Objects_As_Text.dat
for download,

Use the whole page or module.
.


Quantcast