MS ACCESS 2010 ? VBA code to pull the background color from one field in a table and apply it to a row in an MS ACCESS FORM?
We would like to highlight a row in an MS ACCESS form based on a value in a column.
We'd like to keep the background color in a separate table and use the value in the form column to look up the corresponding background color and then apply it to all the rows that are in the form that have the corresponding value in the specified column.
? how do we do that?
Microsoft AccessVBA
Last Comment
philkryder
8/22/2022 - Mon
Jeffrey Coachman
I think conditional formatting will do what you are asking...
Create a continuous view form.
Move all the control close to each other, so that they touch on all sides.
In design view, ...select all the controls on the detail section (The "Row"), while holding down the Shift key.
Then click: Format-->Conditional formatting
Click: New Rule
Enter something like: Expression is [YourField]=3
Then set the Background color to whatever you like.
Click Apply, ...then click OK
Save the form
Re-open the form
yes,
but,
we want to dynamically be able to change the colors via a table field that corresponds to the field matching the value. We do not want to be locked in ahead of time by pre-selecting a color in the UI. ? kapish ?
Create a continuous view form.
Move all the control close to each other, so that they touch on all sides.
In design view, ...select all the controls on the detail section (The "Row"), while holding down the Shift key.
Then click: Format-->Conditional formatting
Click: New Rule
Enter something like: Expression is [YourField]=3
Then set the Background color to whatever you like.
Click Apply, ...then click OK
Save the form
Re-open the form
Simple screenshot and sample DB attached.