PDA

View Full Version : Manipulating individual control instances in continuous forms?



Pheliciano
11-28-2010, 08:58 PM
I have a continuous form in my current database that displays a list of records from a table with a check box control next to each record. I want to change the BackColor property of a field control called txtManufacturer when the check box (chkSelected) is selected.

I currently have this code:

Private Sub chkSelector_AfterUpdate()
If Me.chkSelector.Value = True Then
Me.txtManufacturer.BackColor = RGB(255, 0, 0)
Else
Me.txtManufacturer.BackColor = 15987699
End If
End Sub

Unfortunately, when I select one of the checkboxes, the txtManufacturer control for every record on the form turns red.

Does anyone know how I can get the code to manipulate only the instance of the txtManufacturer control that shares the same record as the selected checkbox?

Imdabaum
11-29-2010, 03:20 PM
You would need to bind the checkbox to the recordsource, so that Access knows that it is per record rather than something over all.

Just out of curiosity, do you notice all the checkboxes getting checked when you check one of the boxes?

OBP
11-30-2010, 11:42 AM
I think that you will find that you can't do this easily with VBA, as Access applies the change to every record.
You could set up Conditional Formatting for the Field as that does work on Continuous Forms.