Set Focus error 2110

  • Thread starter Thread starter Anne
  • Start date Start date
A

Anne

I have a big forms with subforms, tabs...

The AfterUpdate event of some controls is (re)calculating a status,
and changing data (ticking boxes) in the main form and subforms. To
display the new status, the form & subforms are requeried. Which means
that I lost the focus on the selected control.

To avoid the problem, at the end of the AfterUpdate event, I set the
focus on the next control. That worked fine.

Then I don't know what I've done, but now on every .SetFocus, if fires
the error 2110

Any idea what could cause the .SetFocus method not to work anymore?!?

Thanks for your help, as always I am very grateful for the time you
spend answering my questions

Anne
 
Well, you won't be able to set the focus to a control that is either
disabled or not visible (but I think that locked controls are fine). There
are other possibilities, like an empty underlying recordset when you try to
set the focus on one of the controls of a bound form. You are trying to set
the focus on the AfterUpdate event just after having all subforms and the
form to be requeried; so I would that the subforms didn't have the time to
fully reload their recordset before you attempt to reset the focus.

You should try setting the focus on another event. For example, you could
set up a flag and reset the focus on the first OnCurrent event that occurs
after the requerying.
 
Back
Top