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!

LoadFromText deletes source module

Status
Not open for further replies.

rustychef

Technical User
Sep 2, 2004
63
US
I have a code module (Access 2003) that exports all database objects to text files, and have started setting up
code to import these text files into a database.

All my code runs fine and does what its designed to do with one exception. After the code is finished importing the
database objects, the module that contains the import/export code deletes itself!

I have narrowed the culprit down the a single line of code.

Application.LoadFromText intType, strName, strFullPath

The variables are set up correctly and don't have anything to do with it. I know this because the following example
will also delete the module containing the import/export code:

LoadFromText acForm, "frmText", "C:\Temp\Form_frmTest.txt"

I have also tried various file name extensions .frm, .bas, .cls, etc

I have tried loading single objects and entire directories and the code imported everything I tell it to, then deletes itself.

I have also tried running the code from an existing database as well as a new blank one... same results... good code, weird ending.

One other test of interest. As I said the module with the source code gets deleted. When I placed the code in a class
and call it from a module, everything works like it should, then when its done, the module AND the class get deleted!!!

I can write code to create a temp module and insert the code to run (so I don't lose the original source code), but
it seems like there must be something I can do to prevent this unwanted side-effect.

The function LoadFromText is undocumented from MS, and I can't find any search results that talk about modules/classes auto-deleting.

ANY ONE HAVE ANY IDEAS???
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top