By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,853 Members | 1,052 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,853 IT Pros & Developers. It's quick & easy.

How Do I Replace the Primary Code Module for a Form?

P: n/a
I do a lot of my code writing for Access forms at home, where I have
no access to Access.

While in Access, I export the entire primary code module,
xxx.cls where xxx begins "Frm_" and includes the form name as
a text file. Then I make extensive changes to this text file at home:
I would like to import the new version as a replacement for the old,
but I'm afraid to try it since I haven't figured out the exact way to
do this.

I haven't been able to figure out how to get google to tell me either,
so can someone here please help?

thanks, --thelma
May 26 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Have you considered running, from a Standard Module
SaveAsText acForm, "FormName" , "OriginalTextFileName.Ext"
to get your editable text file. This will include all the code plus the
definitions of all the form's objects and their properties, which may
be helpful. You can take this text file home, make a copy and do your
editing in the copy. Then you can take both the files back to wherever
and

modify the original form with
LoadFromText acForm. "FormName" , "EditedTextFile.Ext"

You will of course have the original text file (you edited a copy, I
hope!) to recover from errors with
LoadFromText acForm. "FormName" , "OriginalTextFileName.Ext".
but if the errors seem minor you can simply re-edit your working copy.

After you are happy with your changes you can start an archive of
changes you have made in text form by saving the original and edited
text files with unique names.

LoadFromText is a 100% unforgiving command. It overwrites the original
form (assuming it exists) without any warning whatever. If you don't
preserve backup copies of code and forms the previous manifestations
are gone forever.

But the commands are extremely simple and powerful.

Using one of the saved text files as a template you could even create
an entirely new form at home without Access. I don't know of anyone who
does this, so why not you to be a pioneer?

Did I mention that you lose EVERYTHING if you are not careful to make
backup copies?

May 26 '06 #2

P: n/a
Lyle Fairfield <ly***********@aim.com> wrote:
: Have you considered running, from a Standard Module
: SaveAsText acForm, "FormName" , "OriginalTextFileName.Ext"
: to get your editable text file. This will include all the code plus the
: definitions of all the form's objects and their properties, which may
: be helpful. You can take this text file home, make a copy and do your
: editing in the copy. Then you can take both the files back to wherever
: and

: modify the original form with
: LoadFromText acForm. "FormName" , "EditedTextFile.Ext"

: You will of course have the original text file (you edited a copy, I
: hope!) to recover from errors with
: LoadFromText acForm. "FormName" , "OriginalTextFileName.Ext".
: but if the errors seem minor you can simply re-edit your working copy.

: After you are happy with your changes you can start an archive of
: changes you have made in text form by saving the original and edited
: text files with unique names.

: LoadFromText is a 100% unforgiving command. It overwrites the original
: form (assuming it exists) without any warning whatever. If you don't
: preserve backup copies of code and forms the previous manifestations
: are gone forever.

: But the commands are extremely simple and powerful.

: Using one of the saved text files as a template you could even create
: an entirely new form at home without Access. I don't know of anyone who
: does this, so why not you to be a pioneer?

: Did I mention that you lose EVERYTHING if you are not careful to make
: backup copies?

Thank you. I will try this.

So far I've always remembered to make a backup of the entire
.mdb file before I begin to make any changes. My worst losses
have happened on days where I've made extensive changes in a
single session, forgetting to save when something actually
works, and then losing the entire session's work by making a
change that causes Access to give up with no option for
saving what's already been done.

Actually, I'll try this on a copy of the entire .mdb -- I'm
working with relatively small .mdb's so that's not a problem.
And I do tend to use a 'template' mindset in going from one
project to another, so I probably will use your suggestion
in creating some future form.

--thelma

May 26 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.