vbams-accessnavigationcontrols

Change navigation tab on "Navigation Control" of Access?


Here's my doubt, I have an Navigation Control called "navControl" that haves three tabs("Venda", "Metalização", "Injeção"), and I have one Check Box with three options, I need to change tab according the selected option.

I think I need to use DoCmd.BrowseTo, but don't know how :/

Someone can help me? Thanks


Solution

  • You must set the Navigation Target Name to the name of the form each navigation tab opens in Properties/Data tab of the navigation control..

    Private Sub YourOptionGroup_Click()
        With Me
            Select Case .YourOptionGroup.Value
                Case 1:
                    DoCmd.BrowseTo acBrowseToForm, "Form1", "YourMainFormName.NavigationSubform"
                Case 2:
                    DoCmd.BrowseTo acBrowseToForm, "Form2", "YourMainFormName.NavigationSubform"
                Case 3:
                    DoCmd.BrowseTo acBrowseToForm, "Form3", "YourMainFormName.NavigationSubform"
            End Select
        End With
    End Sub