Re: How To Rebuild Objects From Text Files?
- From: lyle fairfield <lyle.fairfield@xxxxxxxxx>
- Date: Fri, 9 May 2008 05:55:26 -0700 (PDT)
On May 9, 5:33 am, lyle fairfield <lyle.fairfi...@xxxxxxxxx> wrote:
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
orhttp://www.ffdba.com/downloads/Save_ADP_Objects_As_Text.htm
http://www.ffdba.com/downloads/Save_MDB_Objects_As_Text.dat
orhttp://www.ffdba.com/downloads/Save_ADP_Objects_As_Text.dat
for download,
Use the whole page or module.
LoadFromText is a hidden and undocumented procedure.
It may be worthwhile to note that
LoadFromText AcObjectType, ObjectName, FilePath
overwrites the object named ObjectName with whatever instructions are
in FilePath.
There is, TTBOMK, NO recovery from this. The old object now belongs to
the ages, but not to you. Over many years LoadFromText has never
failed me, but if I give it wrong or foolish instructions, it carries
them out, without any warning, just as it carries out any other
instructions.
In summary, the making of backups and/or safe copies may be a
worthwhile expenditure of time and resources before using
LoadFromText.
Coincidentally, I am doing that right now, in an effort to change all
"Guidance" objects and references to same, to "StudentSuccess"
objects. Ain't politics grand? I expect that StudentSuccess staff will
be much more effective than Guidance staff.
The first thing I did was to make a safe copy of the ADP (it could
have been MDB) file.
.
- Follow-Ups:
- Re: How To Rebuild Objects From Text Files?
- From: lyle fairfield
- Re: How To Rebuild Objects From Text Files?
- References:
- How To Rebuild Objects From Text Files?
- From: Wayne
- Re: How To Rebuild Objects From Text Files?
- From: lyle fairfield
- How To Rebuild Objects From Text Files?
- Prev by Date: Carrying form name through to add to filter in OnOpen event in report
- Next by Date: Re: How To Rebuild Objects From Text Files?
- Previous by thread: Re: How To Rebuild Objects From Text Files?
- Next by thread: Re: How To Rebuild Objects From Text Files?
- Index(es):
Relevant Pages
|