| ESquared 2005-10-27, 8:32 am |
|
I did finally find a workaround, although I don't know how globally this
can be applied, as I've only used it on one form so far. I sure hope it
helps someone avoid some frustration.
Access (sometimes?) runs certain events in this order when you click on
the checkbox:
Control_GotFocus
Form_BeforeUpdate
Form_BeforeUpdate (yes, twice, and in certain instances all the primary
key autonumber columns have sequential values starting at 1 the first
time, then have their proper server-side values the second time, but
that's not related to this issue.)
Control_BeforeUpdate
Chb_AfterUpdate
Control_Click
The crash always happens immediately after one of the form_beforeupdate
events (and before the control's beforeupdate event). If both of those
beforeupdates cancelled then the crash does not occur. So my workaround
was surprisingly simple:
Declare a global boolean, something like gfPreventUpdate.
* In the control's GotFocus event:
gfPreventUpdate = True
* In the form's BeforeUpdate event:
Cancel = gfPreventUpdate
* In the control's BeforeUpdate, AfterUpdate, or Click event (whichever
is convenient for you):
gfPreventUpdate = False
Erik
--
ESquaredPosted from - http://www.officehelp.in
|