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
SaveRe****tsAsText
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 SaveRe****tsAsText()
Dim FileName As String
Dim Name As String
Dim Re****t As AccessObject
For Each Re****t In CurrentProject.AllRe****ts
Name = Re****t.Name
FileName = path & Name & Format(Now(), "yyyymmddhhnn") &
".txt"
SaveAsText acRe****t, Name, FileName
Next Re****t
MsgBox "All Done Saving Re****ts 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?


|