Results 1 to 3 of 3
  1. #1
    User25 is offline Novice
    Windows 11 Access 2016
    Join Date
    Nov 2023
    Posts
    3

    Colouring rows/fields in a form based on a condition!


    In a form (Form1) a user enters a date and in a subform (Query1 subform) which is based on a query i see the records from a table filtered by that date. In the subform I would like to write a function to sum the numbers of days worked by an employee and if the result is above ten I would like the lines containing the employee to turn red or maybe the Days fields for that employee. Any advice will be appreciated.
    Attached Files Attached Files

  2. #2
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,940
    Use Conditional Formatting with either an expression or a hidden control that sums the number of days for employee in the
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  3. #3
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Textbox in subform Detail section with expression: =DSum("Days","Attendance","DateWork=#" & [DateWork] & "# AND Employee='" & [Employee] & "'")

    Select all textboxes (works for comboboxes as well) on subform and set CF rule:

    Expression is: [tbxSumDays] > 10

    Should have an Employees table and save EmployeeID into Attendance, not employee name.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Replies: 1
    Last Post: 08-28-2019, 04:26 AM
  2. Replies: 47
    Last Post: 07-12-2017, 08:51 AM
  3. Colouring Rows & Columns
    By Outlook in forum Access
    Replies: 1
    Last Post: 01-12-2011, 09:22 AM
  4. Colouring Fields
    By Merkava in forum Reports
    Replies: 2
    Last Post: 01-14-2010, 05:47 PM
  5. Update 2 fields based on where condition.
    By Confused in forum Access
    Replies: 2
    Last Post: 11-19-2009, 05:21 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