Newd
Newd

Reputation: 2185

How can I set focus to a split form?

I am simply attempting to switch focus to a split form using a button located on another form. This can be broken down to code a simple as this.

Private Sub Command0_Click()

    Forms.Form1.SetFocus

End Sub

This code will work so long as Form1 is in open "Single Form" view. The moment that you change Form1 to "Split Form" view, it no longer changes to Form1 and no error messages pop up.

How can I accomplish setting focus to a split form since obviously the normal way doesn't appear to work.

Edit: I would like to avoid the docmd.Runcommand OpenForm solution or the toggling visible false then true method of solving this problem.

Upvotes: 0

Views: 654

Answers (1)

Krish
Krish

Reputation: 5917

just use docmd.openform frm_name,acNormal will open the form, if already opened will bring it to front (modal forms still stay on top)

Upvotes: 1

Related Questions