How do I format a field in a report based upon the results in another field.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jmtrobough
    New Member
    • Sep 2010
    • 3

    How do I format a field in a report based upon the results in another field.

    Situation is: I have a report that has a field that will be formatted based upon the results in another field. For example if 'Field 2' equals "IBR" 'Field 1' would be formatted with – italics, bold, red font. ‘Field 2’ could equal up to 6 different results changing the font of ‘Field 1’ accordingly. I know this needs to be done by coding but not sure how.

    Thank you for the help.
  • patjones
    Recognized Expert Contributor
    • Jun 2007
    • 931

    #2
    You can use conditional formatting to accomplish this; it won't require you to use code (although it might be possible to use code - but why complicate things?).

    Open the report in design view, click on the field that you want to format (Field 1), and in the Conditional Formatting pop up pick Expression Is, then type [Field 2] = "IBR". Select the formatting option appropriately.

    Let us know how it works.

    Pat

    Comment

    • jmtrobough
      New Member
      • Sep 2010
      • 3

      #3
      zepphead80

      Thanks for the assistance, however this will only work if you have 3 or less conditions. I have at least 6 different conditions.

      Thx

      Comment

      • jmtrobough
        New Member
        • Sep 2010
        • 3

        #4
        Thanks for the assistance, however this will only work if you have 3 or less conditions. I have at least 6 different conditions.

        Thx

        Comment

        • patjones
          Recognized Expert Contributor
          • Jun 2007
          • 931

          #5
          That's why you use the "Expression Is" option, and then type your criteria into the box next to the drop down - which can be as complicated as need be. This is all done on one line.

          Pat

          Comment

          • patjones
            Recognized Expert Contributor
            • Jun 2007
            • 931

            #6
            For example, in my test database I have the conditional formatting on the ERN (Employee Reference Number) field set to [DOB] >= #1/1/1970# And [last name] = "JONES". You can use as many other fields and conditions as you want by typing in the expression just under "Condition 1". It isn't necessary to add other lines.

            Pat

            Comment

            Working...