Results 1 to 8 of 8
  1. #1
    4 Star Lounger
    Join Date
    Jun 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    527
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Form / Field Backcolor (AXP/Win2K)

    I have a form that displays records based on a query. What I would like to do is have a specific field's backcolor be different based on the value of that field. For instance, the field value is 1 or 0. If 0 then the back color should be red, if 1 then the backcolor should be green. FYI, I am using continuous forms.

    Thanks Everybody!

  2. #2
    3 Star Lounger
    Join Date
    Dec 2000
    Location
    USA
    Posts
    379
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Form / Field Backcolor (AXP/Win2K)

    You can use the BackColor property to specify the color for the background of a control. It is listed in Access Help. The Help example shows an If statement using the value of the field on a form to set the color. HTH

  3. #3
    4 Star Lounger
    Join Date
    Jun 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    527
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Form / Field Backcolor (AXP/Win2K)

    Thanks,
    But the key here is continuous forms. I have a query that returns a list of records that populate a form. I can set the backcolor in code but it sets all of the records to the color of the first record. Does anyone else have any ideas?

    Thanks,
    Mark

  4. #4
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,624
    Thanks
    3
    Thanked 60 Times in 60 Posts

    Re: Form / Field Backcolor (AXP/Win2K)

    Check out the conditional formatting that comes with Access 2000 and 2002. It should do what you are attempting to do.
    Wendell

  5. #5
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Form / Field Backcolor (AXP/Win2K)

    I haven't been impressed with conditional formatting in either version. Has your experience been different? Personally, I still prefer the method that worked in earlier versions of Access, using a character like "
    Charlotte

  6. #6
    Bronze Lounger
    Join Date
    Nov 2001
    Location
    Arlington, Virginia, USA
    Posts
    1,394
    Thanks
    0
    Thanked 3 Times in 3 Posts

    Re: Form / Field Backcolor (AXP/Win2K)

    For anyone really interested in this type of trick you can also download a sample database illustrating similar technique from Roger's Access Library.

  7. #7
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,624
    Thanks
    3
    Thanked 60 Times in 60 Posts

    Re: Form / Field Backcolor (AXP/Win2K)

    Actually we've used it pretty successfully in a couple of scenarios. One is showing the user which control currently has focus, and the other was on a continuous form where certain records need to be highlighted. There are some limitations that get in your way (like the number of conditions), but we find it a useful tool in some situations.
    Wendell

  8. #8
    4 Star Lounger SteveH's Avatar
    Join Date
    Jan 2001
    Location
    Chelsea, Gtr London, United Kingdom
    Posts
    587
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Form / Field Backcolor (AXP/Win2K)

    I found this technique in a magazine somewhere (I forget where) so I cannot acknowledge the original author.
    Basically you can use a value to colour table with colour swatches in it. You pick up the correct colour from the query and display it in an image control on the form. Sample attached (Acc97)
    Attached Files Attached Files
    Steve H
    IT Lecturer/Access Developer
    O2K SR3/O2010; Win7Pro

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •