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???
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???