Results 1 to 10 of 10

Thread: URGENT Change Background color in Continuous form

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2006
    Posts
    8

    Smile URGENT Change Background color in Continuous form

    Can anybody please help????

    I have a continuous sub form where I'm trying to change the background
    colour of a text box called "Debriefed"

    if the criteria is YES then I want the control to be GREEN
    and RED if the criteria is NO

    The code I have below works if I set the form to a single form however
    it dosen't work if I set it to continuous

    Private Sub Form_Current()
    If [Debriefed] = "Yes" Then
    [Debriefed].BackColor = vbGreen
    Else
    [Debriefed].BackColor = vbRed
    End If
    End Sub

    Many thanks in advance


  2. #2
    Addicted Member Fonty's Avatar
    Join Date
    May 2006
    Location
    New York
    Posts
    173

    Re: URGENT Change Background color in Continuous form

    What do you mean by "continuous"?

  3. #3
    Frenzied Member
    Join Date
    Feb 2003
    Location
    Argentina
    Posts
    1,950

    Re: URGENT Change Background color in Continuous form

    Look at my post #8 in this link.
    Basically you want conditional formatting.
    Tengo mas preguntas que contestas

  4. #4

    Thread Starter
    New Member
    Join Date
    Jun 2006
    Posts
    8

    Re: URGENT Change Background color in Continuous form

    by continuous I meant changing the sub form to a continuous form
    instead of a single form

    the code works in single sub form but not on a continuous sub form

  5. #5

    Thread Starter
    New Member
    Join Date
    Jun 2006
    Posts
    8

    Re: URGENT Change Background color in Continuous form

    Hi salvelinus

    You link was just the job...however Im only a beginner and I didn't really understand the language in the modules etc

    is there a easier way to obtain the code I require
    as I can get my current vba code to work on a single form but when it is a continuous form it dosent work

    hope you can hope
    the code i currently have is

    Private Sub Form_Current()
    If [Debriefed] = "Yes" Then
    [Debriefed].BackColor = vbGreen
    Else
    [Debriefed].BackColor = vbRed
    End If
    End Sub

  6. #6
    Frenzied Member
    Join Date
    Feb 2003
    Location
    Argentina
    Posts
    1,950

    Re: URGENT Change Background color in Continuous form

    I don't think you have to use code (although you could). You can do the conditional formatting from the Format > Conditional Formatting Menu when you have the form in Design view with the textbox selected.
    For Condition 1 select Field value is, then in the next combobox select is equal to, in the last combobox enter "Yes", then click the paint bucket and select green.
    Next click Add to bring up Condition 2, repeat the process for "No", selecting red.
    Yes & No must be in quotes in the Conditional Formatting box, but that isn't necessary for the text box.
    HTH.
    Tengo mas preguntas que contestas

  7. #7

    Thread Starter
    New Member
    Join Date
    Jun 2006
    Posts
    8

    Re: URGENT Change Background color in Continuous form

    Thank you for your reply salvelinus.... the only problem I have is that I'm unfortunately using Access 97

    Do you know of another way

    Many thanks in advance

    C

  8. #8
    Don't Panic! Ecniv's Avatar
    Join Date
    Nov 2000
    Location
    Amsterdam...
    Posts
    5,343

    Re: URGENT Change Background color in Continuous form

    create an image in the continous part, put to the back and make sure its data bit says red or green (the image name)
    I think it is something like that - therefore the form recreates an image for each detail.
    Other methods don't work

    It is crap method for displaying anyway - perhaps look for a control you can use?

    BOFH Now, BOFH Past, Information on duplicates

    Feeling like a fly on the inside of a closed window (Thunk!)
    If I post a lot, it is because I am bored at work! ;D Or stuck...
    * Anything I post can be only my opinion. Advice etc is up to you to persue...

  9. #9
    Frenzied Member
    Join Date
    Feb 2003
    Location
    Argentina
    Posts
    1,950

    Re: URGENT Change Background color in Continuous form

    Sorry, don't know about Access 97. Do you have to use a textbox for user entry, or can you use a label? Might be easier to set color with that.
    Tengo mas preguntas que contestas

  10. #10
    Don't Panic! Ecniv's Avatar
    Join Date
    Nov 2000
    Location
    Amsterdam...
    Posts
    5,343

    Re: URGENT Change Background color in Continuous form

    salvelinus:
    Picture a form design layout of controls.
    Now for each record picture the same controls repeated under each other (grouped by record).
    Then picture for some value in a control the background changes from green to red.

    fairly nice visually - at least whilst you are learning, but not good for proper dbs... imo

    BOFH Now, BOFH Past, Information on duplicates

    Feeling like a fly on the inside of a closed window (Thunk!)
    If I post a lot, it is because I am bored at work! ;D Or stuck...
    * Anything I post can be only my opinion. Advice etc is up to you to persue...

Posting Permissions

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



Click Here to Expand Forum to Full Width