Results 1 to 3 of 3
  1. #1
    DanKoz is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2011
    Posts
    16

    Conditional Formatting based on Query/Table

    I have a report in which exam (test) responses are displayed. If the answers are wrong I want them to appear in red.



    Using the Conditional Formatting dialog box I am able to successfully turn the incorrect answers red if I hard code the correct answer in the dialog box:
    e.g. Field Value Is not equal to "True" (then make the text red)
    This works fine.

    However, if I use the expression builder to point to a table or query field that has the correct answer (instead of hard coding "True") the conditional formatting does not work.
    e.g. Field Value Is not equal to [qryName].[Answer1] (then make the text red)
    This does NOT work.

    I tried comparing to fields in a table instead of a query and it still does not work.

    Does the table or query somehow have to be linked to the report as a datasource? Can I not just point to any table or query in the database?

    Thanks for your suggestions.

    Dan

  2. #2
    Robeen is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    Mar 2011
    Location
    Tulsa, Oklahoma.
    Posts
    1,596
    My experience with conditional formatting in report design view is that there is a limit to how fancy you can get with it.

    I was thinking of how I would do it to get my incorrect answers in red on the report & the easiest way I could come up with [yes - I usually go with the simplest way of doing things!] was:

    Create a query that matches answers sudents' answers with the correct answers and if they match have a new field in the Query that has the value 'Correct' if the answers match & 'Incorrect' if they do not.

    Then, base your report on the query & look for 'Incorrect' and change the color to red when it is found.

    Your field that shows 'Correct' & 'Incorrect' does not have to be visible on the report.

    Let me know if this helps.

    I don't know if you can get really fancy with conditional formatting in Access reports - unless you want to research doing it in VBA.

    All the best!

  3. #3
    DanKoz is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2011
    Posts
    16
    Thanks for your reply. You solution may yet be one I have to pursue.

    However, it appears that right in the Conditional Formatting dialog box there is a link to the expression builder which allows me to specify a table/query and a field, instead of hard coding a value. Yet when I go this route the conditional formatting is not applied. Hard coding the value does work, but not referencing a value in a table/query.

    Dan

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

Similar Threads

  1. Replies: 0
    Last Post: 03-14-2011, 08:38 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