473,756 Members | 3,390 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How To Rebuild Objects From Text Files?

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 SaveObjectsAsTe xt()
path = CurrentProject. path & "\ObjectsAsText \"
SaveDataAccessP agesAsText
SaveFormsAsText
SaveReportsAsTe xt
SaveModulesAsTe xt
MsgBox "All Done Saving Access Objects as Text"
End Sub
Private Sub SaveDataAccessP agesAsText()
Dim FileName As String
Dim Name As String
Dim DataAccessPage As AccessObject
For Each DataAccessPage In CurrentProject. AllDataAccessPa ges
Name = DataAccessPages .Name
FileName = path & Name & Format(Now(), "yyyymmddhh nn") &
".txt"
SaveAsText acDataAccessPag e, 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(), "yyyymmddhh nn") &
".txt"
SaveAsText acForm, Name, FileName
Next Form
MsgBox "All Done Saving Forms as Text"
End Sub
Private Sub SaveReportsAsTe xt()
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(), "yyyymmddhh nn") &
".txt"
SaveAsText acReport, Name, FileName
Next Report
MsgBox "All Done Saving Reports as Text"
End Sub
Private Sub SaveModulesAsTe xt()
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(), "yyyymmddhh nn") &
".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?
Jun 27 '08
16 7247
I've used the code from the linked page that Lyle has posted above to
save and then load as text. The saving bit works fine but then the
code fails at:

app.LoadFromTex t acForm, Name, FileName

with the error:

Runtime error '2285'
(Database Name) can't create the output file.

Not sure what's causing this. Any help would be appreciated.

Jun 27 '08 #11
On May 18, 6:55*am, Wayne <cqdigi...@volc anomail.comwrot e:
No, I'm using the code in total that I copied from your linked page.
It creates the text files and a new database minus the objects in a
new folder, but stops with the error at the line of code that I posted
when trying to recreate the forms. I don't have any data pages, so the
forms are the first thing that it is trying to recreate.
I don't know. A Search for "can't create the output file" in this
newsgroup doesn't find anything pertinent; ditto for 2285.

But a general Google search for "can't create the output file 2285"
returns many hits. A really quick glance at these might make one
wonder if the error is related to file attributes or folder
permissions. But when you "LoadFromTe xt" you're not creating an
"output file", at least not ostensibly (VB/Access might be doing this
with a temporary file behind the scenes.)

So, where from here? Have you tried "On Error Resume Next" to see if
any forms load?

You're writing, obviously, to the folder where the (new) app lives.
And you must have write permissions there or SaveAsText would fail.

That's all that comes to mind on a Sunday morning, but several other
people are using the SaveAsText-LoadFromText duality as a cleanser and
perhaps someone will recognize the problem and be able to help.
Jun 27 '08 #12
On May 19, 12:01*am, lyle fairfield <lyle.fairfi... @gmail.comwrote :
I don't know. A Search for "can't create the output file" in this
newsgroup doesn't find anything pertinent; ditto for 2285.

But a general Google search for "can't create the output file 2285"
returns many hits. A really quick glance at these might make one
wonder if the error is related to file attributes or folder
permissions. But when you "LoadFromTe xt" you're not creating an
"output file", at least not ostensibly (VB/Access might be doing this
with a temporary file behind the scenes.)

So, where from here? Have you tried "On Error Resume Next" to see if
any forms load?

You're writing, obviously, to the folder where the (new) app lives.
And you must have write permissions there or SaveAsText would fail.

That's all that comes to mind on a Sunday morning, but several other
people are using the SaveAsText-LoadFromText duality as a cleanser and
perhaps someone will recognize the problem and be able to help.
Thanks for your help Lyle. I tried using "On Error Resume Next" and
the result was interesting. An "Errors.txt " file was created for each
form, 37 of them in this case. Each Errors.txt file contains
nothing. I thought that Vista might be doing strange things to me and
booted into XP but the result was the same. As you say, perhaps
someone else will be able to help.
Jun 27 '08 #13
On May 18, 11:34*am, Wayne <cqdigi...@volc anomail.comwrot e:
On May 19, 12:01*am, lyle fairfield <lyle.fairfi... @gmail.comwrote :
I don't know. A Search for "can't create the output file" in this
newsgroup doesn't find anything pertinent; ditto for 2285.
But a general Google search for "can't create the output file 2285"
returns many hits. A really quick glance at these might make one
wonder if the error is related to file attributes or folder
permissions. But when you "LoadFromTe xt" you're not creating an
"output file", at least not ostensibly (VB/Access might be doing this
with a temporary file behind the scenes.)
So, where from here? Have you tried "On Error Resume Next" to see if
any forms load?
You're writing, obviously, to the folder where the (new) app lives.
And you must have write permissions there or SaveAsText would fail.
That's all that comes to mind on a Sunday morning, but several other
people are using the SaveAsText-LoadFromText duality as a cleanser and
perhaps someone will recognize the problem and be able to help.

Thanks for your help Lyle. *I tried using "On Error Resume Next" and
the result was interesting. *An "Errors.txt " file was created for each
form, 37 of them in this case. *Each Errors.txt file contains
nothing. *I thought that Vista might be doing strange things to me and
booted into XP but the result was the same. *As you say, perhaps
someone else will be able to help.
A little further search brings up this error described but no
suggestion as to its cause or cure. If you were to post the text file
for the first form that fails, some of us might see if we can load the
form into a database with the LoadFromText method. If so, we will know
its not your form. If not, we might be able to study the problem in
general terms, (or you could just send me the text file and I'll post
it: lyle dot fairfield at gmail dot com).
Jun 27 '08 #14
On May 19, 1:51*am, lyle fairfield <lyle.fairfi... @gmail.comwrote :
A little further search brings up this error described but no
suggestion as to its cause or cure. If you were to post the text file
for the first form that fails, some of us might see if we can load the
form into a database with the LoadFromText method. If so, we will know
its not your form. If not, we might be able to study the problem in
general terms, (or you could just send me the text file and I'll post
it: lyle dot fairfield at gmail dot com).- Hide quoted text -
After a few hours of experimentation I've made a few observations.
The DB I am working with is an A2003 database, but I have a sneaking
suspicion that it is one that I have converted from A2000. Not sure
if this has any bearing on anything but I imported all of the objects
into a new A2003 database and tried running the code again. It
partially worked this time. As before, all the objects were saved as
text, but this time some of the forms were imported from the text
files before it fell over. I then tried importing some of the forms
that were missed on the import one by one by using the LoadFromText
method and this worked. This seems to indicate that there is nothing
inherently wrong with the forms. When I view the forms they look and
work fine.

The scenario is the same on a couple of other databases that I tried
running the code on. Some of the forms will import, then the code
fails. I'm 99% sure that these are native A2003 databases and haven't
been converted from an earlier version. As to why the original code is
failing and not importing all the objects, I don't know. It may well
remain a mystery of the ages. At least now I know that in a worst
case scenario if I ever have to use this, I can export all the objects
to text using the original code and then use the LoadFromText method
to import them all one by one. Quite laborious, but it would work.

I intend to experiment with this further when I have a bit more time
on my hands and will post if I get to the root of the problem.
Jun 27 '08 #15
I encountered the same error trying to export/import an MDB as text:

Error 2205 (Database Name) can't create the output file.

I was using the same posted code. The error occurred at the same place as
Wayne's attempt: app.LoadFromTex t acForm, Name, FileName

Same error was thrown for reports as for forms, however qry defs and
modules re-loaded without error. Wayne wondered if the error related to
compatibility between versions (a converted Access 2000 database). Mine
was a converted Access 2000 database as well, so I did some experimenting.

Starting from scratch, I converted the Access 2000 mdb to Access 2003
using the 'Convert Database' menu tool. The resulting database
consistently threw error 2205 with this code.

I then created a new (empty) 2003 mdb and imported all objects from the
original mdb. The resulting database was error-free when running the text
export/import code.

This confirms that the problem likely relates to non-native 2003 databases
(converted from Access 2000). Apparently when Access imports objects from
A2000 into A2003 it creates 'pure' A2003 objects, whereas the 'Convert
Database' menu tool yields some obscure differences.

FWIW, I have included below (after the quoted text from Wayne) the 2 text
files from the same (simple) form, (1) exported from the
A2000-converted-to-A2003, and (2) exported from the native A2003 version.
There are 2 lines in the native 2003 version which are not in the
converted version:

---------------
GUID = Begin
0x8b8505f89b289 04d82001a842a85 0a56
End
NameMap = Begin
0x0acc0e5500000 000000000000000 000000000000000 000000c00000002 000000,
0x0000000000000 000000000000000
End
---------------

I am unsure if these lines might be related to the error, but in general
my results suggest that importing all objects into a new 2003 database is
a better strategy for conversion than using Access' menu tool, at least
for text export/import functionality, but perhaps for other (hidden)
functionality as well.

One other note. My mdb had a reference to a local MDE code library. The
referenced MDE was created in Access 2000, so I originally suspected this
lib ref. was the culprit. However, using the imported (native 2003)
database, there was no error with or without the Access 2000 MDE lib ref.
Using the converted version, the error was consistently thrown, with or
without the reference.

Chris

--
Chris Martin
UNC-CH
On Sun, 18 May 2008, Wayne wrote:
On May 19, 1:51*am, lyle fairfield <lyle.fairfi... @gmail.comwrote :
>A little further search brings up this error described but no
suggestion as to its cause or cure. If you were to post the text file
for the first form that fails, some of us might see if we can load the
form into a database with the LoadFromText method. If so, we will know
its not your form. If not, we might be able to study the problem in
general terms, (or you could just send me the text file and I'll post
it: lyle dot fairfield at gmail dot com).- Hide quoted text -

After a few hours of experimentation I've made a few observations.
The DB I am working with is an A2003 database, but I have a sneaking
suspicion that it is one that I have converted from A2000. Not sure
if this has any bearing on anything but I imported all of the objects
into a new A2003 database and tried running the code again. It
partially worked this time. As before, all the objects were saved as
text, but this time some of the forms were imported from the text
files before it fell over. I then tried importing some of the forms
that were missed on the import one by one by using the LoadFromText
method and this worked. This seems to indicate that there is nothing
inherently wrong with the forms. When I view the forms they look and
work fine.

The scenario is the same on a couple of other databases that I tried
running the code on. Some of the forms will import, then the code
fails. I'm 99% sure that these are native A2003 databases and haven't
been converted from an earlier version. As to why the original code is
failing and not importing all the objects, I don't know. It may well
remain a mystery of the ages. At least now I know that in a worst
case scenario if I ever have to use this, I can export all the objects
to text using the original code and then use the LoadFromText method
to import them all one by one. Quite laborious, but it would work.

I intend to experiment with this further when I have a bit more time
on my hands and will post if I get to the root of the problem.

-----------------------
form from Access 2000 converted to Access 2003
-----------------------
Version =20
VersionRequired =20
Checksum =1319579709
Begin Form
AutoResize = NotDefault
RecordSelectors = NotDefault
NavigationButto ns = NotDefault
DividingLines = NotDefault
DefaultView =0
ScrollBars =0
TabularFamily =0
BorderStyle =3
PictureAlignmen t =2
DatasheetGridli nesBehavior =3
GridX =24
GridY =24
DatasheetFontHe ight =10
Left =270
Top =210
Right =8910
Bottom =4530
DatasheetGridli nesColor =12632256
RecSrcDt = Begin
0x805fd4ecd754e 340
End
Caption ="Form not ready"
DatasheetFontNa me ="Arial"
Begin
Begin Label
BackStyle =0
FontName ="Tahoma"
End
Begin CommandButton
FontSize =8
FontWeight =400
ForeColor =-2147483630
FontName ="Tahoma"
End
Begin Section
Height =2880
BackColor =-2147483633
Name ="Detail"
GUID = Begin
0xa45a656675e46 f489f624edcd2db e040
End
Begin
Begin Label
OverlapFlags =85
TextAlign =2
Width =5580
Height =600
FontSize =16
Name ="Label0"
Caption ="Form not ready."
GUID = Begin
0xc096deb6ece8a e41af262a11be30 cb7e
End
End
Begin CommandButton
OverlapFlags =85
Left =2100
Top =1140
Width =1035
Height =405
Name ="cmdClose"
Caption ="Close"
OnClick ="[Event Procedure]"
GUID = Begin
0x663bfb42d6a6f 246a33b57112e84 0d45
End
End
End
End
End
End
CodeBehindForm
Attribute VB_GlobalNameSp ace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredI d = True
Attribute VB_Exposed = False
Option Compare Database
Option Explicit
Private Sub cmdClose_Click( )
On Error GoTo Err_cmdClose_Cl ick
DoCmd.Close

Exit_cmdClose_C lick:
Exit Sub

Err_cmdClose_Cl ick:
MsgBox err.Description
Resume Exit_cmdClose_C lick

End Sub
-----------------------
-----------------------
-----------------------
-----------------------
form from Access 2003 imported from Access 2000
-----------------------
Version =20
VersionRequired =20
Checksum =-416531212
Begin Form
AutoResize = NotDefault
RecordSelectors = NotDefault
NavigationButto ns = NotDefault
DividingLines = NotDefault
DefaultView =0
ScrollBars =0
TabularFamily =0
BorderStyle =3
PictureAlignmen t =2
DatasheetGridli nesBehavior =3
GridX =24
GridY =24
DatasheetFontHe ight =10
Left =270
Top =210
Right =8910
Bottom =4530
DatasheetGridli nesColor =12632256
RecSrcDt = Begin
0x805fd4ecd754e 340
End
GUID = Begin
0x8b8505f89b289 04d82001a842a85 0a56
End
NameMap = Begin
0x0acc0e5500000 000000000000000 000000000000000 000000c00000002 000000
,
0x0000000000000 000000000000000
End
Caption ="Form not ready"
DatasheetFontNa me ="Arial"
Begin
Begin Label
BackStyle =0
FontName ="Tahoma"
End
Begin CommandButton
FontSize =8
FontWeight =400
ForeColor =-2147483630
FontName ="Tahoma"
End
Begin Section
Height =2880
BackColor =-2147483633
Name ="Detail"
GUID = Begin
0xb7565ebe5f29f 74c92a186f19a1e 8405
End
Begin
Begin Label
OverlapFlags =85
TextAlign =2
Width =5580
Height =600
FontSize =16
Name ="Label0"
Caption ="Form not ready."
GUID = Begin
0x5e6a4c00564df c4d90ae25a2e161 fb30
End
End
Begin CommandButton
OverlapFlags =85
Left =2100
Top =1140
Width =1035
Height =405
Name ="cmdClose"
Caption ="Close"
OnClick ="[Event Procedure]"
GUID = Begin
0x0b9721ce18424 949a07184307590 3f42
End
End
End
End
End
End
CodeBehindForm
Attribute VB_GlobalNameSp ace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredI d = True
Attribute VB_Exposed = False
Option Compare Database
Option Explicit
Private Sub cmdClose_Click( )
On Error GoTo Err_cmdClose_Cl ick
DoCmd.Close

Exit_cmdClose_C lick:
Exit Sub

Err_cmdClose_Cl ick:
MsgBox Err.Description
Resume Exit_cmdClose_C lick

End Sub

Jun 27 '08 #16
On May 23, 11:26*pm, Chris Martin <nr.cmartin.dfg h....@med.unc.e du>
wrote:
I encountered the same error trying to export/import an MDB as text:

* * Error 2205 (Database Name) can't create the output file.

I was using the same posted code. The error occurred at the same place as
Wayne's attempt: *app.LoadFromTe xt acForm, Name, FileName

Same error was thrown for reports as for forms, however qry defs and
modules re-loaded without error. Wayne wondered if the error related to
compatibility between versions (a converted Access 2000 database). Mine
was a converted Access 2000 database as well, so I did some experimenting.

Starting from scratch, I converted the Access 2000 mdb to Access 2003
using the 'Convert Database' menu tool. The resulting database
consistently threw error 2205 with this code.

I then created a new (empty) 2003 mdb and imported all objects from the
original mdb. The resulting database was error-free when running the text
export/import code.

This confirms that the problem likely relates to non-native 2003 databases
(converted from Access 2000). Apparently when Access imports objects from
A2000 into A2003 it creates 'pure' A2003 objects, whereas the 'Convert
Database' menu tool yields some obscure differences.

FWIW, I have included below (after the quoted text from Wayne) the 2 text
files from the same (simple) form, (1) exported from the
A2000-converted-to-A2003, and (2) exported from the native A2003 version.
There are 2 lines in the native 2003 version which are not in the
converted version:
Thanks for the reply (and detective work) Chris. I'll import all
objects into a new A2003 database and see how it goes.

Jun 27 '08 #17

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
2034
by: Trev | last post by:
Is it possible to rebuild dependancy information for objects in a database? I can hardly ever DTS a database across to another server because something will fail with the message "invalid object name <name_of_a_view>". This happend to me just now on a database with just 12 tables and 4 views. What hope for my other databases with 100s of views?
0
406
by: Daniel Deptford | last post by:
Hello there, We're having a some problems with Visual Studio 2003 at the moment. In a nutshell, devenv.exe terminates when trying to run our application after a full rebuild. After trying to track this down using Filemon.exe (from www.sysinternals.com) and debugging devenv.exe (in developer studio :)) using the Microsoft symbols (from the MS Symbol server), it appears that it crashes in mspdb71.dll when doing a full dependency check. ...
3
19622
by: Ant | last post by:
Hello, Why is there a choice between build Solution & Rebuild Solution in the IDE. what is the difference? When would you use one over the other? Many thanks for your thoughts Ant.
11
5887
by: CSN | last post by:
Is it possible to iterate over an array in plpgsql? Something like: function insert_stuff (rel_ids int) .... foreach rel_ids as id insert into table (rel_id, val) values (id, 5);
5
7386
by: Colin Anderson | last post by:
I discovered, with great excitement, this article http://www.davison.uk.net/vb2notes.asp when researching methods for emailing from Access via Notes. Unfortunatly, when I run this I get a Run-time error. When I run it on an XP machine it crashes, but on an NT box it just generates an unknown error, handled by the error handler. I have debugged and stepped through the code and have narrowed the issue to the point at which the...
25
1895
by: MLH | last post by:
In an earlier post entitled... "A97 closes down each time I open a particular report" it has been suggested that I rebuild problematic table - one in which some corruption has occurred. I don't know which table is the problem, so I would like to rebuild them all in a new database. I'm sure most of you would cringe at the thought of having to do this manually for most of your applications.
0
1159
by: rohinichandrap | last post by:
Hi, I have a problem with the pdf files in one of my workspaces I am working with.This is during an upgrade from Visual studio 6.0 to Visual Studio .Net 2003. The workspace has two projects A,B. Both the project's .exe,.map,.pdb files are placed in the same release folder. The project setting "Extensions to Delete on clean" under General project settings has .pdb extension also.
1
3267
by: pcosway | last post by:
Core question: where does MySQL create temporary files in a quick rebuild? ( I thought I knew the answer, but now can't find them.) I'm trying to rebuild a file using "repair table <tablenamequick". It's worked fine in the past, but it doesn't seem to be rebuilding. "show processlist" does report the State is "Repair by sorting". I've been trying to monitor progress by looking at the temporary files being used in the rebuild, but I...
4
2410
by: RAM | last post by:
Hello, I am learning .NET 2.0, Visual ... 2005 Express Edition. Could you explain me please the difference betwen Build and Rebuild commands? Thank you. /RAM/
0
9455
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10031
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9869
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8709
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6534
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5302
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3805
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3354
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2665
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.