Results 1 to 5 of 5
  1. #1
    azhar2006's Avatar
    azhar2006 is offline Expert
    Windows 7 32bit Access 2007
    Join Date
    Mar 2012
    Posts
    528

    conditional formatting

    Hello all
    I want to write a condition in a text box (conditional formatting)
    He
    If the value (zero) is the color of a text box and Green if more than (zero), the color red
    Please Help


    Thank you

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,527
    In the ON_CURRENT event (when the user moves to a record)

    Code:
    if txtBox = 0 then
      txtbox.forecolor = vbGreen
    else
      txtbox.forecolor = vbRed
    endif

  3. #3
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,524
    Or use Conditional Formatting, on the ribbon. It will look better on a form in Continuous or Datasheet view.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  4. #4
    azhar2006's Avatar
    azhar2006 is offline Expert
    Windows 7 32bit Access 2007
    Join Date
    Mar 2012
    Posts
    528
    Thank you very much ranman
    In the above code change the font color and not the color field
    ...................................
    Professor pbaldy
    What is the expression that we write in (Conditional Formatting) ?

  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,524
    Along the lines of

    [FieldName] = 0

    or

    [FieldName] > 0
    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. Replies: 6
    Last Post: 05-26-2013, 09:10 PM
  2. Conditional Formatting
    By riaarora in forum Access
    Replies: 6
    Last Post: 09-03-2012, 05:58 AM
  3. Conditional Formatting
    By riaarora in forum Access
    Replies: 2
    Last Post: 08-12-2012, 02:09 AM
  4. Conditional Formatting
    By bellevue in forum Forms
    Replies: 4
    Last Post: 05-17-2012, 06:03 AM
  5. Conditional formatting
    By avarusbrightfyre in forum Forms
    Replies: 3
    Last Post: 07-01-2011, 11:18 AM

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