Hi all,
2nd day with you, 2nd post...
I've got 2 combo boxes on a form which cascade but I'm struggling to make the dependent box (lowest in the cascade) appear and disappear in line with the condition of the independent (highest in the cascade).
Closest I can get is to set the visibility of the dependent combo box to 'No' and have it turned to 'Yes' in the After_Update event of the independent box that populates the dependent box.
But then if I change the value in the independent box, the dependent combo box remains visible, even though there is no data in it.
I think I need to tell the program: "Starting with dependent combo box hidden, If item selected in independent combo box initiates dependent combo box, show dependent combo box. If not, keep dependent combo box hidden. If selection in independent combo box changes from 'If' condition to 'If not' condition, re-hide dependent combo box."
It's frustrating to be beginning to understand the language the program is speaking but not to know any of the right words to talk with it!
Anyway, here's the code I'm using:
Private Sub cboPrefix_AfterUpdate()
cboGMCMSuffix.Visible = True
Me.cboGMCMSuffix.RowSource = "SELECT GMCMSuffix FROM" & _
" tblGMCMSuffix WHERE PrefixID = " & Me.cboPrefix & _
" ORDER BY GMCMSuffix"
Me.cboGMCMSuffix = Me.cboGMCMSuffix.ItemData(0)
End Sub
Also, on a related note (and if I could figure this out, I might not have bothered sorting the main issue but hey, I want it done right!), if I delete any text in either box, I can still input data that's not been pulled from the underlying tables.
Yaaarggghhh!
Any help'd be much appreciated.