Almost anything is possible! Here's some sample code, where the form to be opened is
2ndForm and the tabbed page to be displayed on open of 2ndForm is named
ThirdPage. The final argument of the OpenForm command is called openargs, and you assign a value to it in the calling form, then check for its value in the FormLoad event of the called form
and do something (open a tabbed page isn this case) accordingly.
- 'On the first form
-
Private Sub GotoTabbedPage_Click()
-
Dim strPageToOpen as String
-
strPageToOpen = "ThirdPage"
-
DoCmd.OpenForm "2ndForm", , , , , , strPageToOpen
-
End Sub
-
-
'On the second form
-
Private Sub Form_Load()
-
If OpenArgs = "ThirdPage" Then
-
ThirdPage.SetFocus
-
End If
-
End Sub
In your code in the first form you need to set the variable
strPageToOpen equal to the preference from your first form, however you determine that, then in the second form, include in the If...End If construct all possible choices for pages to open. If you have many of these you might want to replace the If...End If construct with Select Case.