John:
Your sample db works fine; however, it won't work in my actual database. Here's why, there's actual a third level (i.e., Rank/Title) which values is driven by the 2nd combo "Type". So, if officer is selected then I only get officer ranks (which also vary based on service).
I did not include the 3rd level cascading as the rank title (in my view) has nothing to do whether someone is military or civilian. That said, however, when plugging in your code, it's now overwriting the 3rd level lookup information. Nothing seems to be easy.
Below is the full VBA code before integrating your latest solution.
Since you uploaded your db in .zip formatting, are you saying you can't unzip a document? Things would be much clearer if you were to view my sample database. If you can't unzip, is there another method I could provide you the sample db? "A picture is worth a thousand words.
Thank you,
EEH
Code:
Private Sub cboService_Change()
'Refreshes and clears combo boxes
Me.cboType.Requery
Me.cboType = Me.cboType.ItemData(0)
Me.cboType = Null
Me.cboRankTitle.Requery
Me.cboRankTitle = Me.cboRankTitle.ItemData(0)
Me.cboRankTitle = Null
End Sub
Private Sub cboService_AfterUpdate()
'Calls function cboType in order to hide/unhide pages
With Me.cboType
.Value = Null
.Requery
End With
cboType_AfterUpdate
End Sub
Private Sub cboType_Change()
'Refreshes and clears combo boxes
Me.cboRankTitle.Requery
Me.cboRankTitle = Me.cboRankTitle.ItemData(0)
Me.cboRankTitle = Null
End Sub
Private Sub cboType_AfterUpdate()
'Calls the function ShowHideTypePages
ShowHideTypePages
End Sub
Private Sub ShowHideTypePages()
'Page control's tabs (Military | Civilian | Contractor) are hidden/unhidden depending on value selection of combo boxes "Service" AND "Type" based on the following logic:
'- Any service value (Navy, Air Force, Army, Coast Guard, or Marines) unhides the "Military tab (**regardless** of type officer/enlisted).
'- Alternatively, if service equals "Civilian" AND type equals "Civilian" OR "Contractor" either page "Civilian" or "Contractor" is brought up, respectively.
With Me.tabContacts
.Pages("Civilian").Visible = (Nz(Me.cboType, "") = "Civilian")
.Pages("Contractor").Visible = (Nz(Me.cboType, "") = "Contractor")
.Pages("Military").Visible = ((Nz(Me.cboService, "") <> "Civilian") And (Nz(Me.cboService, "---") <> "---"))
End With
End Sub
Private Sub cboRankTitle_Change()
'Refreshes combo box
Me.cboGoToContact.Requery
End Sub