In an ms access 2010 database, I have a listbox whose afterupdate procedure needs (among other things) to navigate to a specific tab in a navigation subform. I can get it to change the SourceObject property of the navigation subform, but the selected tab does not get changed, so the user ends up seeing the right source object with the wrong tab selected. This looks unprofessional. How can I change both the selected tab and the source object?
I uploaded a simplified database that recreates the problem to this file sharing site.
The list box that needs its afterupdate method changed is called lstbxClients
. Here is my current draft of its afterupdate method, which is currently throwing an error:
Private Sub lstbxClients_AfterUpdate()
Dim rst
Set rst = Me.RecordsetClone
rst.FindFirst "ClientNumber = " & lstbxClients.Column(0)
Me.Bookmark = rst.Bookmark
'Forms!Main!NavigationSubform.Form!NavigationSubform.SourceObject = "qryListCommunicationForms"
DoCmd.BrowseTo acBrowseToForm, "qryListCommunicationForms", "Forms!Main!NavigationSubform.Form!NavigationSubform"
Form.NavigationSubform " "
'Forms!Main!NavigationSubform.Form!NavigationSubform.SelectedTab = "CommFormsNavBtn"
Set rst = Nothing
End Sub
How do I change the code above so that it changes both the selected tab AND the source object of the navigation subform when the user clicks on a different record in the listbox?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…