Results 1 to 4 of 4
  1. #1
    andy49's Avatar
    andy49 is offline VIP
    Windows 10 Access 2007
    Join Date
    Nov 2016
    Location
    London
    Posts
    1,051

    Test if a group of fields are -1

    I have about 14 chkboxes (varies from year to year) and need to check whether all of them are checked


    I figured I could do it by checking each one in a loop but wondered if anyone has a faster way.

    The values are stored in a table

    fields are ID (autonumber)


    chk1 Boolean
    chk2 Boolean etc


    Thanks in anticipation

    Andy

  2. #2
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,928
    In a query

    SELECT *
    FROM myTable
    WHERE chk1=false or chk2=false.......

    Or by storing them in normalised way (i.e. record for each checkbox) so the query doesn't need to be changed each year

  3. #3
    andy49's Avatar
    andy49 is offline VIP
    Windows 10 Access 2007
    Join Date
    Nov 2016
    Location
    London
    Posts
    1,051
    Can you clarify a little what you mean about "storing them in a normalised way".

    I need a checkbox for each for each class (there are 18 classes this year but could be 21 other years)

    I'm already creating the checkbox form in vba.

    A real nuisance!!


    Sent from my iPhone using Tapatalk

  4. #4
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,928
    Can you clarify a little what you mean about "storing them in a normalised way".
    I indicated in my post
    (i.e. record for each checkbox)
    there are a number of ways but all depends on what your db does.

    I've no idea what chk1, chk2 etc does, but perhaps it is stages to be completed. So maybe you have a table of stages and have a many to many table between stages and the records in your 'main table'. If a record exists in the many to many table, then that is the equivalent of chkbox=true. No record and that is the equivalent of chkbox=false. Or the other way round. As I said it depends on how your db works.

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

Similar Threads

  1. Replies: 2
    Last Post: 11-26-2016, 01:07 PM
  2. Replies: 25
    Last Post: 11-23-2014, 02:43 PM
  3. Test String test besed on table data
    By igourine in forum Programming
    Replies: 3
    Last Post: 12-01-2013, 06:16 AM
  4. Replies: 2
    Last Post: 08-24-2012, 07:28 AM
  5. Keying in Test answers to Access DB from Written Test
    By CityOfKalamazoo in forum Access
    Replies: 3
    Last Post: 03-01-2010, 08:58 AM

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