Access 2010 set focus on subform control

Just a quick post because I know I’ll need this in the future. In our little database we have here in the office I was wanting a specific control in a subform to become active when someone clicks in any of the blank space on the main form. I couldn’t get the stupid thing to work until I found a forum saying you have to first reference the subform and then reference the control after it.

Not sure it’s your issue, but to set the focus to a subform control from a main form, you need both:

Me.subformcontrol.SetFocus
Me.subformcontrol.Form.somecontrol.SetFocus

I just kept trying to use the one statement on the bottom. Can’t believe I haven’t run into this until now, but there you go. It worked like a charm.

Source:
Access 2010 – Navigation Page, cannot set focus to “inside” form

  1. Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: