alwainwright
Registered User.
- Local time
- Today, 17:07
- Joined
- Aug 24, 2005
- Messages
- 19
I am using the below sub to create a cascading combo box, which works fine.
However, not every subject in tblsubjects has a subcategory, so I want a msgbox to appear only when there are subcategories to choose from. At the moment I am using
If Me![Subject2] = "Dispute Resolution" Or [Subject2] = "Employment" Then Msgbox "text"
but this will mean changing the code everytime new subjects with subcategories are added. Can anyone help please?
Thanks!
Alison
Private Sub Subject1_AfterUpdate()
On Error Resume Next
Subcategory1.RowSource = "Select tblsubjects.Subcategory " & _
"FROM tblsubjects " & _
"WHERE tblsubjects.Subject = '" & Subject1.Value & "' " & _
"ORDER BY tblsubjects.Subcategory;"
End Sub
However, not every subject in tblsubjects has a subcategory, so I want a msgbox to appear only when there are subcategories to choose from. At the moment I am using
If Me![Subject2] = "Dispute Resolution" Or [Subject2] = "Employment" Then Msgbox "text"
but this will mean changing the code everytime new subjects with subcategories are added. Can anyone help please?
Thanks!
Alison
Private Sub Subject1_AfterUpdate()
On Error Resume Next
Subcategory1.RowSource = "Select tblsubjects.Subcategory " & _
"FROM tblsubjects " & _
"WHERE tblsubjects.Subject = '" & Subject1.Value & "' " & _
"ORDER BY tblsubjects.Subcategory;"
End Sub