Home > Archive > MS Access project with SQL Server > October 2005 > Re: SQL Server Bit Fields & Bound Form Fields Incompatibility









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: SQL Server Bit Fields & Bound Form Fields Incompatibility
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

Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com