INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Access Howto:

How do I get different background colours for records by Frink
Posted: 21 Jan 02

If you have a field [strStatus] in a table which can have values of "On", "Off" or blank, and you want "Off" records to have a Red background and "On" records to have a Green background, this is the FAQ for you.

Make a tabular form based on the table, and make all the backgrounds to the fields in the detail section transparent.
Now create a text field which covers the whole of the detail section. Make it font WebDings, Foreground colour Red, Disabled and Locked. Make it's background transparent and select 'Move To Back'
In its Control Source put:

=IIf([strStatus]="Off",String$(20,"g"),"")

This field will be empty unless strStatus="Off", in which case it would be a string of 20 WebDings g characters, which happen to be a solid block.
Create another identical field, but this time make it Green and its Control Source should be:

=IIf([strStatus]="On",String$(20,"g"),"")

Now open the form. All records with a status of Off will have a Red background, and all records with a status of On will have a Green background.

If the coloured bar is not high enough then increase the font size.
If the coloured bar is too short then increase the '20' in the Control Sources.
If the coloured bar does not look like a coloured bar then replace the 'g' in the control sources with an alternative letter and change the font to something more appropriate. A good way to find the character to use is by using Insert Symbol in Word.

Hope that makes your forms prettier,


- Frink

Back to Microsoft: Access Other topics FAQ Index
Back to Microsoft: Access Other topics Forum

My Archive

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close