Unanswered: dynamically refer to a bound control in single row of a continuous form
I've browsed through the forum, but have not seen anything to help solve my issue.
In an Access 2013 project I have a subform with the default view of Continuous Forms.
This form has some text boxes and two bound combo boxes (Category and Rating)
cboCategory is bound to a query. cboRating is bound to a value list.
The desired logic is that for each row on the subform, depending on what value is selected for the combobox 'Catagory', the combobox 'Rating' may be a required field (or not.)
The code I tried occurrs on the cboCategory_AfterUpdate event:
If Me.cboCategory.Column(3) <> 0 Then 'column 3 being the 'IsThisARequiredRatingCategory' data
Me.cboRating.BackColor = RGB(255, 255, 183)
Me.cboRating.BackColor = vbWhite
The problem I encounter is that the AfterUpdate event of the cboCategory in any row will update the backcolor of cboRating in all rows.
If I put a stop in the code and ask for the value of column 3 of cboCategory in the Immediate window, it knows which row is current and gives me the correct answer. So how do I refer specifically to the cboRating box in the current row?
Figured it out. I set conditional formatting on cboRating: "cboCategory.Column(3) <> 0" to change cboRating's backcolor.
The only thing I needed to do in code was refresh the form on cboCategory_AfterUpdate event.
scarecrow: I should have thought of that for you.
tinman: I should have felt it in my heart.
So, what have you learned, Dorothy?