Results 1 to 6 of 6
  1. #1
    Join Date
    Apr 2002
    Location
    Illinois
    Posts
    133

    Unanswered: Change background for certain conditions

    I have a continuous form for a veterinarian program that is displaying search results in the detail section. The form is based on a query. I want the background color for the animal's ID# to change based on its gender - white for male, pink for female. Both the ID# and the gender appear in the results.

    I have tried the form's OnCurrent and OnLoad events with no luck. All ID#'s appear in one color or the other.

    Is this even possible?

    TIA
    SteveH

  2. #2
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    in design view try right-clicking the txtbox and playing with
    conditional formatting

    (recent A versions only)

    izy
    currently using SS 2008R2

  3. #3
    Join Date
    Feb 2004
    Location
    New Zealand
    Posts
    1,469
    Provided Answers: 10
    OR

    on the the event Current()

    Private Sub Form_Current()

    if me.feildvalue.text ="M" then
    me.ID.BackColor = vbRed
    else
    me.ID.BackColor = vbBlue
    end if



    End Sub
    hope this help

    StePhan McKillen
    the aim is store once, not store multiple times
    Remember... Optimize 'til you die!
    Progaming environment:
    Access based on my own environment: DAO3.6/A97/A2000/A2003/A2007/A2010
    VB-NET based on my own environment started 2007
    SQL-2005 based on my own environment started 2008
    YOUR PASSWORD IS JUST LIKE YOUR TOOTHBRUSH DON'T SHARE IT.
    DONT WORRY ABOUT THOSE WHO TALK BEHIND YOUR BACK
    THEY'RE BEHIND YOU FOR A REASON

  4. #4
    Join Date
    Apr 2002
    Location
    Illinois
    Posts
    133
    This doesn't work on a continuous form. The event fires once and the field is the same color for all records
    SteveH

  5. #5
    Join Date
    Feb 2004
    Location
    New Zealand
    Posts
    1,469
    Provided Answers: 10
    oooooo it a continuous form well that a differnace story

    try this

    http://www.mvps.org/access/forms/frm0024.htm
    hope this help

    StePhan McKillen
    the aim is store once, not store multiple times
    Remember... Optimize 'til you die!
    Progaming environment:
    Access based on my own environment: DAO3.6/A97/A2000/A2003/A2007/A2010
    VB-NET based on my own environment started 2007
    SQL-2005 based on my own environment started 2008
    YOUR PASSWORD IS JUST LIKE YOUR TOOTHBRUSH DON'T SHARE IT.
    DONT WORRY ABOUT THOSE WHO TALK BEHIND YOUR BACK
    THEY'RE BEHIND YOU FOR A REASON

  6. #6
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,928

    Conditional Formatting

    If it's a continuous Bound form, then I'd try the Conditional Formatting as izyrider suggested.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

Posting Permissions

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