Results 1 to 12 of 12
  1. #1
    ngruson is offline Novice
    Windows XP Access 2003
    Join Date
    Apr 2010
    Posts
    6

    Conditional formatting on form

    Hi,

    I have a form which is bound to a table. The table contains a few records which are shown on the form. There's also a rectangle in the detail section of the form. The backcolor of the rectangle should depend on the value of a field in the record.

    Value field Color


    1 Green
    2 Blue
    3 Orange

    Is there a form event which fires per record I can use to accomplish this?

    Thanks,
    Nils

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2007
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Every time you move to a different record you will get a FORM Current Event.

  3. #3
    weekend00 is offline I may not be right
    Windows XP Access 2003
    Join Date
    Aug 2010
    Posts
    1,295
    "conditional formatting" is right for you. setup the conditional formatting as you desire then that's it. no need any code or event.

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2007
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Quote Originally Posted by weekend00 View Post
    "conditional formatting" is right for you. setup the conditional formatting as you desire then that's it. no need any code or event.
    ...except I don't believe a rectangle will respond to Conditional Formatting.

  5. #5
    jpkeller55 is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Sep 2010
    Posts
    169
    Is the rectangle just a color indicator that alerts the users a certain circumstance exits? Could you not just make an unbound text box on the form and size it to the size of your rectangle. Then, you could use conditional formatting on the text box to do what you want. Three conditions for the three differnt colors.

  6. #6
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2007
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Quote Originally Posted by jpkeller55 View Post
    Is the rectangle just a color indicator that alerts the users a certain circumstance exits? Could you not just make an unbound text box on the form and size it to the size of your rectangle. Then, you could use conditional formatting on the text box to do what you want. Three conditions for the three differnt colors.
    Is there something wrong with simply using code in the Current event of the form? I'm not trying to be obstinate, just curious.

  7. #7
    jpkeller55 is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Sep 2010
    Posts
    169
    Nothing wrong from my perspective!

  8. #8
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2007
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    If a poster shows an inclination toward code, I try and encourage this as much as I can. There is so much more available when you know and are comfortable with code that it deserves as much air time on this forum as it can get. I hope you don't mind and I hope the OP continues with code.

  9. #9
    jpkeller55 is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Sep 2010
    Posts
    169
    You are correct...I agree. Just throwing a low tech solution out there. Take it or leave it.

  10. #10
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2007
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    I don't object to trying to use ConditionalFormatting in this case, just wanted to let you and other know why I responded as I did. Your solution would work as well and thank you for presenting it.

  11. #11
    weekend00 is offline I may not be right
    Windows XP Access 2003
    Join Date
    Aug 2010
    Posts
    1,295
    I tried to use code to do it. But I could not identify the rectangle for each record, they have the same name (just like one column name for all records). for example, the rectangle's name is "box1", when I set box1.backcolor=xx, all rectangles in all records changed.

    I am eager to know how to use VBA code to set the box ( or column) in different records.

  12. #12
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2007
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Well there goes most of this thread. If your form is in Continuous Form view then you will need to use Conditional Formatting as was suggested and a bound TextBox control to boot. It is the only way AFAIK to get individual records in a Continuous Form view to show up differently.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Conditional Formatting
    By pkstormy in forum Code Repository
    Replies: 0
    Last Post: 08-30-2010, 09:31 PM
  2. Conditional Formatting
    By DanOzDirect in forum Reports
    Replies: 3
    Last Post: 07-21-2010, 08:49 PM
  3. Conditional Formatting
    By cevatyildiz in forum Forms
    Replies: 8
    Last Post: 04-30-2010, 12:01 PM
  4. Conditional Formatting (on Open form?)
    By christopheb in forum Forms
    Replies: 0
    Last Post: 03-16-2010, 07:07 AM
  5. Conditional formatting
    By ylivne in forum Reports
    Replies: 1
    Last Post: 07-12-2009, 06:18 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums