I have a form that has a column of data (txtLastName) - with many repeated values.
I would like to change the back-color of the field each time the data value in the field changes.
For example:
Anderson
Anderson
Anderson
Abby
Abby
Smith
Smith
I would like the first occurance of Abby and Smith to have a different background color.
In code - I am able to loop through the reords (using DoCmd.GoToRecord) and identify where the changes occur, but when I try to set the background color (Me.Form.txtLastName.BackColor = vbYellow) - it sets it for every cell.
I have also tried to create another text-box where I could update the value to 1 or 0 based on if the name changed for that row (I would then create a conditional color for the name cell - based on the value of 1 or 0 in the text box). But each time I set the value of one row's text-box - all of the rows would change. I belive this is becuase it is not a bound control.... but I don't want to bind it to anything becuase I just want to set the value in code.
Any help or direction is appreciated!!
Thanks,
Jennifer
I would like to change the back-color of the field each time the data value in the field changes.
For example:
Anderson
Anderson
Anderson
Abby
Abby
Smith
Smith
I would like the first occurance of Abby and Smith to have a different background color.
In code - I am able to loop through the reords (using DoCmd.GoToRecord) and identify where the changes occur, but when I try to set the background color (Me.Form.txtLastName.BackColor = vbYellow) - it sets it for every cell.
I have also tried to create another text-box where I could update the value to 1 or 0 based on if the name changed for that row (I would then create a conditional color for the name cell - based on the value of 1 or 0 in the text box). But each time I set the value of one row's text-box - all of the rows would change. I belive this is becuase it is not a bound control.... but I don't want to bind it to anything becuase I just want to set the value in code.
Any help or direction is appreciated!!
Thanks,
Jennifer