2110: Can't move the focus to subform control

B

BruceM

In the After Update event of a combo box on the main form, I am attempting
to move the focus to a subform, but I receive error 2110 telling me that I
cannot do so. I can click into the subform, so it doesn't seem to be an
issue of its being locked or anything like that. After much fruitless
searching I am no closer to solving the problem. I have tried setting the
focus to a particular control on the subform, but that doesn't help. Same
with saving the record first, and every other suggestion I have been able to
find. Any ideas what could be causing this?
 
S

Steve

When you need to set the focus to a control on a subform, you must first set
the focus on the subform control (Border around the subform) and then set
the focus on the control on the subform. It takes two lines of code:
Me!NameOfSubformControl.SetFocus
Me!NameOfSubformControl.Form!NameOfControlOnSubform.SetFocus

PC Datasheet
Providing Customers A Resource For Help With Access, Excel And Word
Applications
(e-mail address removed)
 
B

BruceM

Thanks for the reply. I tried exactly that. It's what I had intended to
say when I wrote that I had tried setting the focus to a particular subform
control. I tried both with the bang and with the dot, and I tried
Forms!frmName!SubformName.Form syntax, but always the same result: Error
2110.
 
B

BruceM

As it happens, a compact and repair straightened out the whole thing. I
suspected something was wrong when I tried to save the record (Me.Dirty =
False) without setting the focus, and the error message stating that I
couldn't set the focus occurred anyhow. I use detailed error handling, and
the error message told me that I couldn't set the focus to the control |
(that's the pipe character). Also, the code broke on the Me.Dirty = False
line. As I said, I wasn't trying to set the focus at all, so I wondered if
there was some phantom code. That's when I decided to take a crack at
Compact and Repair.
By the way, all I needed to do was set the focus to the subform control, not
to a specific control on the subform. Maybe that's because there is only
one control on the subform that can receive the focus.
 

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

Top