Get Focus (Run-time error '2110')

R

RL

I have a form with several sub-forms, one of which contains a button.

When that button is selected, I want to run a complicated macro. However,
this macro is normally called from the main form and was created on the
assumption that the focus would be on the main form, not a sub-form. So, if
the button simply runs that macro, several errors appear along the lines of:
'The object doesn't contain the control...'

My work around was to change the button to run the following code:
Forms("BandRepricingFacility").Controls("RefocusFromMargin").SetFocus

The 'RefocusFromMargin' control has a 'On Got Focus' event to run the macro.

This worked perfectly, temporarily. However, for some reason, this has
started to produce the following error:

"Run-time error '2110'.
Microsoft Office Access can't move the focus to the control
RefocusFromMargin."

I am not aware that I changed any of the controls properties. It is visible
and enabled. The only change I made was to copy both the control on the main
form and the button on the sub-form and then edit the copies in order to call
a different macro.

Do you have any idea what may be causing this error?

Many thanks,
RL
 

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