Results 1 to 2 of 2
  1. #1
    Join Date
    May 2014

    Unanswered: conditional formatting on option box

    I have a continuous form. On which I have a frame and three option boxes with values 1, 2 and 3 what I am trying to do if one record is selected in option box other text boxes of the same record turn red I am using this code which works perfectly expect that it's doing for all records. I want that particular record to turn red.

    Private Sub Form_current()
    End Sub
    Private Sub Frame53_Click()
    End Sub
    Sub FormatGroup()
     Select Case Frame53
     Case 1
     OrderNumber1.BackColor = vbRed
     ProductName1.BackColor = vbRed
     VNumber1.BackColor = vbRed
     Case 2
     OrderNumber1.BackColor = vbYellow
     ProductName1.BackColor = vbYellow
     VNumber1.BackColor = vbYellow
     Case 3
     OrderNumber1.BackColor = vbGreen
     ProductName1.BackColor = vbGreen
     VNumber1.BackColor = vbGreen
    ' Case Else
    ' grpBooked.BackColor = vbYellow
     End Select
     End Sub

  2. #2
    Join Date
    Jun 2005
    Richmond, Virginia USA
    Provided Answers: 19
    That's how Continuous View Forms work...the formatting of a given control on one record is applied to that control on all records, when done through code! The only way around this is to use Conditional Formatting off of the menu or ribbon, depending on version. Here's a step-by-step for doing it for OrderNumber1; after doing this simply repeat the steps for ProductName1 and VNumber1. In Form Design View:

    1. Right Click OrderNumber1
    2. Click on Conditional Formatting
    3. Under Condition1 select Expression Is
    4. In the next box enter [Frame53] = 1
    5. Use the BackColor ('bucket') icon and select Red from the palette
    6. Hit Add
    7. Under Condition2 select Expression Is
    8. In the next box enter [Frame53] = 2
    9. Use the BackColor ('bucket') icon and select Yellow from the palette
    10. Hit Add
    11. Under Condition3 select Expression Is
    12. In the next box enter [Frame53] = 3
    13. Use the BackColor ('bucket') icon and select Green from the palette
    14. Hit OK

    Do this for all three Controls and you're done!

    Linq ;0)>
    Last edited by Missinglinq; 04-26-15 at 13:06.
    Hope this helps!

    The problem with making anything that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

Posting Permissions

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