Set Focus error 2110

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
 
S

Sylvain Lafontaine

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Go to Control / Set Focus 1
Set Focus 2
SetFocus gives run-time error 2110 2
Set Focus 3
Kill Focus on Subform 2
Code doesn't work on Afterupdate? 7
Change Tab Without changing focus 1
Set the focus 3

Top