[AccessD] Error 2110: can't move the focus to control...

Tina Norris Fields tinanfields at torchlake.com
Fri Dec 28 10:27:27 CST 2012


Aha!  Thanks, Stuart - and everybody - because this was a great teaching 
and learning moment.  I learned something new today!
T

Tina Norris Fields
tinanfields at torchlake.com
231-322-2787

On 12/26/2012 4:25 PM, Stuart McLachlan wrote:
> In your Lost_focus you are trying to set_focus on one control while at the same time you are
> clicking on an image (setting focus) and setting focus to a different control during that event..
>
> Triggering another  windows message/event inside an event handler can often cause
> problems like this.
>
> It's a bit like the old problem of changing text in a text box in the OnChange event.
>
> You are setting up  a conflict where Windows tries set the focus to two different controls at
> the same time.  TimeEntryNarrative (when the use clicks and sets the focus on the img) AND
> HoursBillable ( when the user's click causes the previous control to lose focus).
>
> The problem is your attempt to control workflow by setting focus in the LostFocus event
> which is contrary to the whole concept of event driven as opposed to procedural
> programming.   The solution is : don't do that.  :-)
>
> You can continue after you get the error with no problems because focus is no longer on the
> txtEdit, so the Lost_focus doesn't trigger and cause the same problem again.
>   
>



More information about the AccessD mailing list