ConditionalFormatting.mdb (beginner) |
Post Reply |
Author | |
Roger Carlson
Microsoft MVP Joined: 20 Feb 2008 Status: Offline Points: 261 |
Post Options
Thanks(0)
Posted: 01 Aug 2008 at 7:03am |
Please consider donating $1 per sample downloaded, find out why here.
ConditionalFormatting Traditionally, conditional formatting in Access was accomplished through the use of VBA code. If I wanted to change the format of a field based on it’s value, I’d do something like this to change the background color of the Balance field based on its value.
Select
Case Me!txtBal or maybe this to format fields based on the value in another field (Check14).
If
Me!Check14 = True Then This works well in Single Form view, but not so well in Continuous Form View or Datasheet View. The problem is that formatting with VBA affects all records the same. This is fine in Single Form view, because you can only see one. So to solve this problem, Microsoft introduced Conditional Formatting to Access Forms and Reports. I’m going to concentrate on forms here, but the same applies to reports. Conditional Formatting is built into the form controls themselves. So to set it, you need to open the form in Design View to get at the control properties. You need to select the control (in this case a textbox) , the FORMAT tab on the Ribbon, and then Conditional Formatting. In this sample, I concentrate on comparing to values within the current record, so I’ll leave the top rule type selected. The next step is to choose the Field Value Is drop down box. It will have 3 choices: ....
To read more, download the sample. Access 2010 (.accdb): ConditionalFormatting2010.zip |
|
|
|
Sponsored Links | Want a good read? Try The Summer of His Life (available on Amazon!) |
Roger Carlson
Microsoft MVP Joined: 20 Feb 2008 Status: Offline Points: 261 |
Post Options
Thanks(0)
|
Updated sample with complete documentation.
|
|
|
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |