Results 1 to 5 of 5
  1. #1
    Chris1112 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Mar 2012
    Posts
    31

    Conditional Formatting w/ Two Criteria

    I need to conditionally format a textbox on a form based on two sets of criteria. The textbox needs to test false for IsDate() and another field requires a value greater than 4. The code I have sets all textboxes on the continuous form to the same color. The code is below. Also, the code is set to run AfterUpdate. How would I set this to conditionally format when the form loads? Thanks for helping.



    Code:
    Private Sub Stage5Walk1_AfterUpdate()    If Me.MaxOfSTAGE.Value > 4 Then
            If Not IsDate(Me.Stage5Walk1.Value) Then
                Me.Stage5Walk1.BackColor = vbBlue
                Else
                Me.Stage5Walk1.BackColor = vbWhite
            End If
        End If
    End Sub

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    Have you tried Conditional Formatting on the ribbon? Using VBA on a continuous form is problematic, as you're seeing.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Chris1112 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Mar 2012
    Posts
    31
    I wasn't aware that I could do multi-criteria conditional formatting using the ribbon. I'm not sure exactly how the ribbon takes criteria. I'll have to play with it. Thanks.

  4. #4
    Chris1112 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Mar 2012
    Posts
    31
    And done. That was pretty damn easy. Thanks Paul.

  5. #5
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    Happy to help!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Conditional Formatting
    By schwabe in forum Reports
    Replies: 2
    Last Post: 02-01-2012, 10:28 AM
  2. Conditional Formatting
    By Paul H in forum Reports
    Replies: 3
    Last Post: 11-07-2011, 11:59 AM
  3. Conditional Formatting on Two Criteria's
    By gopherking in forum Reports
    Replies: 1
    Last Post: 09-20-2011, 02:23 PM
  4. Conditional formatting
    By avarusbrightfyre in forum Forms
    Replies: 3
    Last Post: 07-01-2011, 11:18 AM
  5. Conditional Formatting
    By cevatyildiz in forum Forms
    Replies: 8
    Last Post: 04-30-2010, 12:01 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