Hey all,
I'm not sure if this type of thing has been answered before, but I've looked at most of the available cascading sample boxes on Google, but nothing's really worked for my question so far. (In fact, I'm not even sure if this fits under the typical definition of a "cascading combo box". It was the best title I could come up with on the fly, though.)
So, I have four combo boxes -- denoted as Combo171, Combo173, Combo 175 and Combo177 -- in a form in a database. The first three combo boxes are separate entities from each other (independent events), and the fourth denotes "None" (namely, that the first three conditions aren't met).
Each combo box displays the same two conditions -- "Yes" (bound as "1" in the form and in the table) and "No" (bound as "0" in my form and table).*
I've been pretty good so far with specifying when conditions are met -- if either Combo171, Combo173 or Combo175 show a "Yes" condition, Combo177 automatically defaults to a "No" condition.
Likewise, when the "Yes" condition is selected for Combo177, Combo171, Combo173 and Combo175 all display "No" conditions. If "No" is selected for Combo177, all the other combo boxes remain blank, so the user can pick which condition is marked as "Yes".
However, where I'm drawing a blank is the situation in which the first three combo boxes all report a "No", and Combo177 reports a "Yes". I originally tried to write an If/Then statement in VBA with "And" operators, but it appears that this approach doesn't work.
The sub that I wrote in VBA to try to create a combo box value change based on multiple conditions was:
I've attached a small sample database which contains the fields and macros in question. If anyone has any ideas or feedback on how to improve this, it would be greatly appreciated.
Thank you in advance!
* As a note: originally, I had these as checkboxes, but we wanted to be able to transfer the results of this form to Excel, so that appeared to be a no-go...
I'm not sure if this type of thing has been answered before, but I've looked at most of the available cascading sample boxes on Google, but nothing's really worked for my question so far. (In fact, I'm not even sure if this fits under the typical definition of a "cascading combo box". It was the best title I could come up with on the fly, though.)
So, I have four combo boxes -- denoted as Combo171, Combo173, Combo 175 and Combo177 -- in a form in a database. The first three combo boxes are separate entities from each other (independent events), and the fourth denotes "None" (namely, that the first three conditions aren't met).
Each combo box displays the same two conditions -- "Yes" (bound as "1" in the form and in the table) and "No" (bound as "0" in my form and table).*
I've been pretty good so far with specifying when conditions are met -- if either Combo171, Combo173 or Combo175 show a "Yes" condition, Combo177 automatically defaults to a "No" condition.
Likewise, when the "Yes" condition is selected for Combo177, Combo171, Combo173 and Combo175 all display "No" conditions. If "No" is selected for Combo177, all the other combo boxes remain blank, so the user can pick which condition is marked as "Yes".
However, where I'm drawing a blank is the situation in which the first three combo boxes all report a "No", and Combo177 reports a "Yes". I originally tried to write an If/Then statement in VBA with "And" operators, but it appears that this approach doesn't work.
The sub that I wrote in VBA to try to create a combo box value change based on multiple conditions was:
Code:
Private Sub Combo177_BeforeUpdate(Cancel As Integer)
' This is the combo that seems to be driving me up the wall.
Dim ComboNone As String
If Me.Combo171.Value = "0" And Me.Combo173.Value = "0" And Me.Combo175.Value = "0" Then
ComboNone = (Me.Combo177.Value = "1")
Else
ComboNone = (Me.Combo177.Value = "0")
End If
' I got a message here asking me to save the field before requerying. How do I do this?
'Me.Combo177.Requery
End Sub
Thank you in advance!

* As a note: originally, I had these as checkboxes, but we wanted to be able to transfer the results of this form to Excel, so that appeared to be a no-go...