Results 1 to 4 of 4
  1. #1
    jjsande1492 is offline Advanced Beginner
    Windows 7 64bit Access 2016
    Join Date
    May 2018
    Posts
    38

    Can you count conditionally colored fields?

    Hi, everyone.

    I have a datasheet subform with many fields being displayed (upwards of 100). Some of these are conditionally formatted so if they're blank, they're colored in red. The idea being that users are being reminded that they have to populate all of the required data. The number of 'red' (mandatory) fields will vary. For example, if one field is populated a certain way, two others then become red as well. I want to know how many 'red' cells there are by record. Is there a way to count these cells? My experience in Excel VBA says no, but I thought I would ask. I'd be open to alternative methods to accomplish my goals.



    Cheers,
    jj

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,549
    if its a format condition, then its a data condition too.
    use a query to count the recs. (or DCount)

  3. #3
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,644
    If you want to count how many fields of a single record are Null, something like:
    IIf(IsNull(field1), 1, 0) + IIf(IsNull(field2), 1, 0) + IIf(IsNull(field3), 1, 0)

    As you can see, 100 fields will be impractical. I expect you will have to write a custom function.

    Of what use is this count?

    100 fields is really quite a lot. Possibly data structure could be more normalized.
    Last edited by June7; 06-29-2018 at 04:41 AM.
    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.

  4. #4
    jjsande1492 is offline Advanced Beginner
    Windows 7 64bit Access 2016
    Join Date
    May 2018
    Posts
    38
    Thanks for the responses. The purpose of the count is to determine how many fields are required and how many are left to be filled in. I was trying to avoid counting the number of null fields of a record because that will become complicated. It would be much simpler to count the number of 'red' cells. It doesn't sound like that is possible though. 100 fields is definitely a lot. I have some other posts on this board where I've been interrogated on my normalization. I have improved the structure and joined everything together to give the user a single form with everything on it which is what is required.

    Thanks again.

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

Similar Threads

  1. Replies: 8
    Last Post: 10-24-2016, 08:31 AM
  2. multiple conditionally visible fields
    By KWarzala in forum Modules
    Replies: 2
    Last Post: 04-02-2014, 10:33 AM
  3. Count fields
    By hithere in forum Reports
    Replies: 7
    Last Post: 04-22-2012, 02:15 PM
  4. Conditionally Required Fields
    By HawkGuru in forum Programming
    Replies: 6
    Last Post: 10-03-2011, 05:47 AM
  5. Replies: 0
    Last Post: 03-08-2009, 05:12 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