How to go to a control in a parent form?

I have a main form with a tab control (TabCtl4). Each page has a subform in it. I want to put a button in each subform that navigates to the next tab page (named Page2, index 1) in the main form. I can't seem to get the syntax right:

Private Sub Command23_Click()
    DoCmd.GoToControl Forms!frmMain!TabCtl4.Pages(1)
    DoCmd.GoToControl [Forms]![frmMain]!Page2
    DoCmd.GoToControl Forms!frmMain!TabCtl4.Item(1)
    DoCmd.GoToControl Forms.frmMain.Page2
End Sub

thanks,
triplediamond
triplediamondAsked:
Who is Participating?
 
sigs66Commented:
Hi all

Try this one    
Private Sub Command23_Click()
  Me.Parent("Page2").SetFocus
end sub

Cheers
Steve
0
 
gwgawCommented:
Try this.

Private Sub Command23_Click()
Me.Parent.TabCtl4 = 1
End Sub

gaw
0
 
triplediamondAuthor Commented:
I've found that this works:
    DoCmd.OpenForm "frmMain"
    DoCmd.GoToControl "Page2"

I just tested Steve's answer and that works also. Thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.