Results 1 to 8 of 8
  1. #1
    CraigR is offline Novice
    Windows 10 Access 2016
    Join Date
    Sep 2017
    Posts
    27

    Post Conditional Formating in field 1 fills text in field 2

    I have a field that is a calculation of 2 other fields. The calculation provides positive or negative numbers.


    The field is calculating depth of cut or fill for earthworks.
    So the calculation goes like

    [Field 1] - [Field 2] = [Field 3] [Field 4]

    if [Field 3] calculates a negative number I want [Field 4] to display the text "FILL"
    If [Field 3] calculates a positive number I want [Field 4] to display the text "CUT"

    thank you in advance for any help
    Craig

  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,652
    Try

    =IIf([Field 3] > 0, "Cut", "Fill")
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    CraigR is offline Novice
    Windows 10 Access 2016
    Join Date
    Sep 2017
    Posts
    27
    Thanks, but I receive an error message
    "The expression you entered contains invalid syntax"
    "You may have entered a comma without a preceding value or identifier"

    ???

  4. #4
    andy49's Avatar
    andy49 is offline VIP
    Windows 10 Access 2010 64bit
    Join Date
    Nov 2016
    Location
    London
    Posts
    1,051
    Pbaldy’s syntax seems fine. Did you place the line in your field 4 and rename field3 part.

  5. #5
    CraigR is offline Novice
    Windows 10 Access 2016
    Join Date
    Sep 2017
    Posts
    27
    I keep getting the same error

    I have called my calculation field actually "Field 3"
    and called conditional formatted field "Field 4"
    I have clicked on "Field 4" and clicked "Conditional Formatting"
    Conditional Formatting Rules Manager.... opens
    Show formatting rules for Field 4
    Click "New Rule"
    Check values in the current record or use an expression
    the drop-down I select "Expression is"
    and in the line I paste =IIf([Field 3]>0,"Cut","Fill")
    when I click OK above error message appears

  6. #6
    andy49's Avatar
    andy49 is offline VIP
    Windows 10 Access 2010 64bit
    Join Date
    Nov 2016
    Location
    London
    Posts
    1,051
    Conditional formatting not needed. On the form you’re using, click in field4 in design mode and enter the line you were given. Field4 will automatically work based on field3

  7. #7
    CraigR is offline Novice
    Windows 10 Access 2016
    Join Date
    Sep 2017
    Posts
    27
    Thank you both

    Craig

  8. #8
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Conditional Formatting would affect the format; you wanted to affect the content.
    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: 5
    Last Post: 05-22-2017, 01:34 PM
  2. Replies: 3
    Last Post: 05-09-2016, 07:00 AM
  3. Conditional Formating for Field Before Group
    By AccessLes in forum Reports
    Replies: 9
    Last Post: 07-20-2011, 12:42 PM
  4. Combo Box Fills another field
    By tcheck in forum Access
    Replies: 7
    Last Post: 06-30-2011, 11:49 AM
  5. Conditional Formating (Report Field)
    By mlawson6128 in forum Programming
    Replies: 1
    Last Post: 03-10-2011, 11:23 PM

Tags for this Thread

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