Results 1 to 4 of 4
  1. #1
    Paul H's Avatar
    Paul H is offline Expert
    Windows XP Access 2010 32bit
    Join Date
    Sep 2011
    Location
    Richmond, VA
    Posts
    591

    Conditional Formatting

    What's wrong with this picture?

    Code:
    Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
        If Me.txtStatus_ID = 10 Then Me.txtStatus_ID.ForeColor = "#FF0000"
    End Sub
    When this runs I get Error 13 - Type Mismatch

    This color is the standard Access code for red copied from another text box.

    I changed it to this:


    Code:
        lngRed = RGB(255, 0, 0)
        If Me.txtStatus_ID = 10 Then
            Me.txtStatus_ID.ForeColor = lngRed
        End If
    Now everything is red, regardless of the value of Status_ID.

    I tried it in On Current and NOTHING happened.

    I'm putting this little touch on hold till I hear back from you guys.

    Paul

  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,521
    You'll find the built-in Conditional Formatting easier I suspect. With code, you need an Else clause to handle the alternate color.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Paul H's Avatar
    Paul H is offline Expert
    Windows XP Access 2010 32bit
    Join Date
    Sep 2011
    Location
    Richmond, VA
    Posts
    591
    Nice, another winner.

    Thanks Paul

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Happy to help Paul!
    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 mm07nkb in forum Forms
    Replies: 1
    Last Post: 09-02-2011, 09:58 AM
  2. Conditional Formatting
    By Desstro in forum Programming
    Replies: 3
    Last Post: 12-01-2010, 09:52 PM
  3. Conditional Formatting
    By pkstormy in forum Code Repository
    Replies: 0
    Last Post: 08-30-2010, 09:31 PM
  4. Conditional Formatting
    By DanOzDirect in forum Reports
    Replies: 3
    Last Post: 07-21-2010, 08:49 PM
  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