jamaarneen
Programmer
Hi
I'm updating a chekbox from a textbox-event
My form is bound. continuous. There are 3 textbones (bounded), and a CheckBox (bound to a bool field). If ONE of the textboxes has a value > 0, then the checkbox should be true. else, false. This should be triggerd by the change_event of the textboxes (see code below).
The problem:
When I first open the form, the checkbox appears (something like) grey. That means Null, not selected (true), ant neither empty (false).
If I already have clicked on the checkbox, and then I'm entering a value(number) in the texbox, it workes fine.
But, If i begin entering in the textbox, I get an error (-2147352567), telling "the data has been changed".
here is the code. I wrote a sub, that is called at the change event, after Me.dirty=False (updating).
Code:
With Me
.chkSim = (.txtSim_Man > 0) Or (.txtSim_Vrouw > 0) Or (.txtSim_Kinder > 0)
End with
The source of the form, is a Query. the Query selects from 2 tables: 'Names' from Table_1, and 'SomeData' from Table_2.
Table_1 has 100 Names. Table_2 begins with NO records. The Data input should be via the form. The checkbox and the textboxes are bounded to fields coming from Table_2. So whenever i put in a value, a new record in inserted in Table_2.
The query has 100 records, and so the form. but these 'grey' checkboxes, dosn't exict in fact, untill some data is enterd AND updated.
Very Funny: when I click 'Debug', and then F5, then it seems to continue running perfect. So may I think of surppresing this run-time error?
One more Funny thing: When I put a breakpoint in the code, on the line where the error is happening, then NO error is happening. It just stops - because of the breakpoint, then F5 and it's running perfect...
Hope you can give me an idea. Thanks