I have a grid where the user needs to select some records. The last column has a checkbox (text1 removed, .currentcontrol="chk") bound to a logical field. Grid's recordsource is a readwrite cursor.
My problem is the total field, in another cursor, shown in a readonly textbox below the grid. I'm calling the counting code from checkbox's .interactive change, and it sometimes fires, sometimes not. Most often, it works on/off, i.e. once works, once doesn't. I've tried several known tricks - before calling the code, do
1. dodefault()
2. this.value=this.value
3. this.setfocus()
4. go recno()
5. calling the calculation from .lostfocus instead
None of this works - the calculation is never sure to see the last change. It either sees the last change sometimes, or never - depending on which trick I try. So, how do I get the change written into the controlsource and be sure that the calculation routine sees it? From where do I call it?
Update: the last sentence gave me the idea. I'm now doing this:
replace (this.ControlSource) with this.Value
nodefault
thisform.de.CalculateIM()
And it works. Thanks to
Auntie Emma.