E
EarlCPhillips
I am a volunteer programmer at the local Food Bank. I manage the volunteer
tracking program. Lately I have noted that some records end up with
incorrect values in spite of thorough data editing during input (dates,
codes, etc.). I force a recheck of data whenever a transfer to a new record
occurs, stopping the transfer if editing is not correct. This seems to work
well. It calls the Form_BeforeUpdate prior to the transfer. I set a global
variable to true if editing is in error so I have a switch to check before
transfer.
Still, some records get saved with obvious errors in the data, e.g. a date of
3009, an invalid activity code. I tried testing before closing by calling the
original edit event (Form_BeforeUpdate) from the shutdown event (Form_Close)
to try to verify that all edits are still correct. I encounter reference
errors when the event Form_BeforeUpdate is called from the Form_Close, in
spite
of using explicit references, such as
"If IsNull(Forms!frmMain!Scheduling!ScheduleDate) Then" or
"If IsNull(Forms("frmMain")("Scheduling")("ScheduleDate")) Then"
where the main form "frmMain" contains control "Scheduling", which contains
sub-form frmActivity, which contains field ScheduleDate, the scheduled date of
the proposed activity. These references work fine as long as I check the data
from a combo box used to transfer to another record. However, when I call
this same subroutine from the MS Access Class Object frmMain Form_Close
event, it fails with a bad reference.
Why the reference errors?
tracking program. Lately I have noted that some records end up with
incorrect values in spite of thorough data editing during input (dates,
codes, etc.). I force a recheck of data whenever a transfer to a new record
occurs, stopping the transfer if editing is not correct. This seems to work
well. It calls the Form_BeforeUpdate prior to the transfer. I set a global
variable to true if editing is in error so I have a switch to check before
transfer.
Still, some records get saved with obvious errors in the data, e.g. a date of
3009, an invalid activity code. I tried testing before closing by calling the
original edit event (Form_BeforeUpdate) from the shutdown event (Form_Close)
to try to verify that all edits are still correct. I encounter reference
errors when the event Form_BeforeUpdate is called from the Form_Close, in
spite
of using explicit references, such as
"If IsNull(Forms!frmMain!Scheduling!ScheduleDate) Then" or
"If IsNull(Forms("frmMain")("Scheduling")("ScheduleDate")) Then"
where the main form "frmMain" contains control "Scheduling", which contains
sub-form frmActivity, which contains field ScheduleDate, the scheduled date of
the proposed activity. These references work fine as long as I check the data
from a combo box used to transfer to another record. However, when I call
this same subroutine from the MS Access Class Object frmMain Form_Close
event, it fails with a bad reference.
Why the reference errors?