Option Compare Database
Option Explicit
Private Sub btnViewInTab_Click()
' Navigate to the "f_ParentDetails" form within the subform holding this form
' This will only work if the subform holding this form has the "f_ParentDetails" form associated with it
DoCmd.BrowseTo acBrowseToForm, "f_ParentDetails", , "ParentID = " & Me.ParentID
' Alternatively, we can specify the exact path for more consistency:
' DoCmd.BrowseTo acBrowseToForm, "f_ParentDetails", "Main.Subform0>MyNavigationForm.NavigationSubform0", "ParentID = " & Me.ParentID
End Sub
Private Sub btnViewHere_Click()
' f_OrangeForm is not associated to the subform that holds this form, so it does not browse to any tab
' Resulting in the opening of the "f_OrangeForm" in the subform holding this form
DoCmd.BrowseTo acBrowseToForm, "f_OrangeForm"
' Alternatively, we can specify the exact path for more consistency:
' DoCmd.BrowseTo acBrowseToForm, "f_OrangeForm", "Main.Subform0>MyNavigationForm.NavigationSubform0"
' We can open unassociated forms in any tab like this:
' DoCmd.BrowseTo acBrowseToForm, "f_OrangeForm", "Main.Subform0>MyNavigationForm.NavigationSubform0>f_ParentDetails.ChildrenListSubform"
' It can not browse to itself,
' the filter does not work and its subform breaks because it can't hold its parent
' No errors, though
' DoCmd.BrowseTo acBrowseToForm, "f_ParentDetails", "Main.Subform0>MyNavigationForm.NavigationSubform0>f_ParentDetails.ChildrenListSubform", "ParentID = " & Me.ParentID
End Sub
Private Sub btnViewInNav_Click()
DoCmd.BrowseTo acBrowseToForm, "f_ParentDetails", "Main.Subform0", "ParentID = " & Me.ParentID
End Sub