Y
Yarik
Hello,
I am using MS Access 2003. (FWIW, this is about an ADP project, not
MDB.)
A form has a variable that is initialized (by some function call) in
Form_Load() and then stays unchanged for the form's entire lifetime.
(In a language more advanced than VBA, it would be a constant, not a
variable; unfortunately, in VBA I cannot initialize a constant by non-
constant expression). Specifically, in my case it looks like this:
Private sTempFileName as String
...
Private Sub Form_Load()
...
sTempFileName = GenerateTempFileName(...)
...
End Sub
Private Sub Form_Unload()
...
' Use sTempFileName to delete the file
...
End Sub
Private Sub SomeEventHandler(...)
...
' Use sTempFileName to read from (or write to) the file.
...
End Sub
At run-time, everything works just fine.
However, when I am debugging the application, the following problem
occurs: while the application is running and the form is open in "form
mode" (i.e. not in design mode), certain "on-the-fly" changes of the
application's code cause Access to "reset" the abovementioned variable
- silently! The variable becomes blank/empty, just like it was before
initialization in Form_Load, and obviously the form, relying on
variable's being initialized, becomes inoperational.
Interestingly enough, I don't remember a case when a change to the
form's own code would ever cause this problem. The simplest way I
found to reproduce this problem is to change some class module used by
the form.
My brief experiments demonstrated that this happens with all form
variables, regardless of their types - they all get silently
"reset"...
I do not remember such behavior in MS Access 2000 ...
So my question is:
Is this "problem" a feature or a bug in Access 2003?
Thank you,
Yarik.
I am using MS Access 2003. (FWIW, this is about an ADP project, not
MDB.)
A form has a variable that is initialized (by some function call) in
Form_Load() and then stays unchanged for the form's entire lifetime.
(In a language more advanced than VBA, it would be a constant, not a
variable; unfortunately, in VBA I cannot initialize a constant by non-
constant expression). Specifically, in my case it looks like this:
Private sTempFileName as String
...
Private Sub Form_Load()
...
sTempFileName = GenerateTempFileName(...)
...
End Sub
Private Sub Form_Unload()
...
' Use sTempFileName to delete the file
...
End Sub
Private Sub SomeEventHandler(...)
...
' Use sTempFileName to read from (or write to) the file.
...
End Sub
At run-time, everything works just fine.
However, when I am debugging the application, the following problem
occurs: while the application is running and the form is open in "form
mode" (i.e. not in design mode), certain "on-the-fly" changes of the
application's code cause Access to "reset" the abovementioned variable
- silently! The variable becomes blank/empty, just like it was before
initialization in Form_Load, and obviously the form, relying on
variable's being initialized, becomes inoperational.
Interestingly enough, I don't remember a case when a change to the
form's own code would ever cause this problem. The simplest way I
found to reproduce this problem is to change some class module used by
the form.
My brief experiments demonstrated that this happens with all form
variables, regardless of their types - they all get silently
"reset"...
I do not remember such behavior in MS Access 2000 ...
So my question is:
Is this "problem" a feature or a bug in Access 2003?
Thank you,
Yarik.