Below is code I am using on a form. When the PPEEyeProUnsafe
checkbox is true, the code automatically has the Cagegories
ComboBox populate with one of the dropdowns "Personal
Protective Equipment". That works fine. When the
Personal Protective Equipment is selected in that combobox
it cascades to what will appear in the Behaviors ComboxBox.
When something is selected in the Behaviors ComboxBox that
cascades to what will appear in the UnsafeDescription
ComboBox. That works too.
My problem is
When I check another CheckBox i.e. BodyPosition the
Categories Box will populate with the Body Position
value which is also one of the Categories CombBox dropdowns
but then the Behaviors ComboBox still has the values
that go with the Personal Protective Equipment part of
the Categories ComboBox. If I physically select from the
Categories ComboBox, everything works well. When I am just
populating the Categories ComboBox from the Yes/No it does
not update the Behaviors Combo.
I am sorry this is so long and I hope I have explained it
well enough for someone to understand.
checkbox is true, the code automatically has the Cagegories
ComboBox populate with one of the dropdowns "Personal
Protective Equipment". That works fine. When the
Personal Protective Equipment is selected in that combobox
it cascades to what will appear in the Behaviors ComboxBox.
When something is selected in the Behaviors ComboxBox that
cascades to what will appear in the UnsafeDescription
ComboBox. That works too.
My problem is
When I check another CheckBox i.e. BodyPosition the
Categories Box will populate with the Body Position
value which is also one of the Categories CombBox dropdowns
but then the Behaviors ComboBox still has the values
that go with the Personal Protective Equipment part of
the Categories ComboBox. If I physically select from the
Categories ComboBox, everything works well. When I am just
populating the Categories ComboBox from the Yes/No it does
not update the Behaviors Combo.
I am sorry this is so long and I hope I have explained it
well enough for someone to understand.
Code:
Private Sub PPEEyeProUnsafe_AfterUpdate()
If Me.PPEEyeProUnsafe = True Then
Me.Categories.Visible = True
Me.Behaviors.Visible = True
Me.UnsafeDescription.Visible = True
Me.Comments.Visible = True
Me.UnsafeBox.Visible = True
Me.update_rec.Visible = True
Me.Categories.Value = "Personal Protective Equipment"
Else
If Me.PPEEyeProUnsafe = False Then
Me.Categories.Visible = False
Me.Behaviors.Visible = False
Me.UnsafeDescription.Visible = False
Me.Comments.Visible = False
Me.UnsafeBox.Visible = False
Me.update_rec.Visible = False
Me.Categories.Value = ""
End If
End If
End Sub
Code:
Private Sub Categories_AfterUpdate()
On Error Resume Next
Behaviors.RowSource = "SELECT DISTINCT ObserversCategoriesTbl.Behaviors " & _
"FROM ObserversCategoriesTbl " & _
"WHERE ObserversCategoriesTbl.Categories = '" & Categories.Value & "' " & _
"ORDER BY ObserversCategoriesTbl.Behaviors;"
Me.Behaviors = Blank
Me.UnsafeDescription = Blank
End Sub
Private Sub Behaviors_AfterUpdate()
On Error Resume Next
UnsafeDescription.RowSource = "SELECT DISTINCT ObserversCategoriesTbl.UnsafeDescription " & _
"FROM ObserversCategoriesTbl " & _
"WHERE ObserversCategoriesTbl.Behaviors = '" & Behaviors.Value & "' " & _
"ORDER BY ObserversCategoriesTbl.UnsafeDescription;"
End Sub