Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Save Object As Text

Status
Not open for further replies.

dpimental

Programmer
Jul 23, 2002
535
US
All, you know the method Application.SaveAsText - it allows you to save an object as text.

Does anyone know a way to save the text of the object to the database as a field value in a table. I want to covert a number of objects as text and then save them to memo fields, so that I can convert them back to objects (application.LoadAsText) on-the-fly?

David Pimental
(US, Oh)
 
Thanks, much appreciated. I found something similar.

I was just wondering whether there was anything within the method that would allow me to store the object to the database; but I can do it in two steps.

David Pimental
(US, Oh)
 
If all you want is the actual content of the module(s), then yes, there is a way to do that, but as far as exporting the neat display of all controls and attributes, that I have not seen.

Once upon a time I wrote code that would create a 'data dictionary' of all objects, their controls and properties, but the output was scattered across various tables.
 
Actually, what I was thinking of was the following.

Our databases are large - I'm sure they won't set any size records.
But, my idea was to take certain objects and load them (as text) on demand.
And if I had the text (to load them with) stored in the database, it would make it easier.

David Pimental
(US, Oh)
 
Ahhh, now I think you just lost me...

When you say "But, my idea was to take certain objects and load them (as text) on demand.", exactly what are you trying to do? For example, let's say you have a typical database with object types such as 'Forms', 'Reports', 'Tables, 'Modules', 'Queries'. And of course your tables have whatever data your business requires.

When you say 'load them (as text) on demand', I am confused if you mean load a FORM or REPORT since it would duplicate whatever matching object you already have.
If you had some people that had "subset" copies of the database (not all objects), and you wanted to give that person a new report or form, then why not just import the object directly?

Happy to help if I can understand what you are trying to do.
Wayne
 
The method Application.SaveAsText allows you to export objects (forms, reports, macros, modules) from you database to your file system as text files.

There is also a method called Application.LoadAsText. This method takes the text file you exported by the SaveAsText method and reloads the object from that text file

This makes the job of making access objects mobile.
It is a lot easier to move them around as text files.

My idea was to create table to house the text content the files and load them into any database I chose.

In fact, you could develop a system of adding the text file content to a custom table and the next time the database is opened, you could have the objects recreated from the text content.

Anyways, that's what I'm thinking of doing.

David Pimental
(US, Oh)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top