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

    Chkboxes taking values from a field

    Tbl
    Field one chkId auto number
    Field one gpname string


    Field two date checked (date)
    Field three true/false true for any value in the table)




    I've a field in the table which shows which groups (from 15 groups) have been checked by the user.


    Group1 true
    Group2 true
    Group4 true
    Group7 true

    Etc

    There are some groups which may not have been checked and I want to show these on a form with checkboxes.

    So group1chk is true
    Group2chk is true
    Group3chk is false and so on


    I have already managed to do it in Vba (bringing the table into a record set then going through each chkbox and seeing if the table is "true."

    But wondered if I've missed a faster way to link the value in the field to an individual checkbox.

    Thanks for any help.






    Sent from my iPhone using Tapatalk

  2. #2
    AccessPower's Avatar
    AccessPower is offline Competent Performer
    Windows 10 Access 2013 64bit
    Join Date
    Oct 2016
    Posts
    165
    Edit: read that completely wrong.

    Looping through checkbox controls:

    Code:
    Dim ctl As Control
    Dim strListbox as String
    For Each ctl In Me.Controls
        If ctl.ControlType = acCheckBox Then
            If ctl.Value <> True Then
                strListbox = strListbox & ";" & ctl.name
            End If
        End If
    Next ctl
    
    strListbox = Mid(strListbox, 2)
    
    me.myListbox = strListbox
    The code above adds the name of the unchecked checkbox control to a listbox called myListbox.

    OR...

    You could set the value of each checkbox as a unique numerical value. Then have them add up. With a lot of math you should be able to get the running total and determine which ones aren't checked right away. I think there are 225 combinations if you have 15 checkboxes.

  3. #3
    andy49's Avatar
    andy49 is offline VIP
    Windows 10 Access 2007
    Join Date
    Nov 2016
    Location
    London
    Posts
    1,051
    This isn't what I'm after though.


    Sent from my iPhone using Tapatalk

  4. #4
    andy49's Avatar
    andy49 is offline VIP
    Windows 10 Access 2007
    Join Date
    Nov 2016
    Location
    London
    Posts
    1,051
    I have a table with the "trues". Just want to tick the checkboxes for these faster than running through them testing each one.


    Sent from my iPhone using Tapatalk

  5. #5
    ssanfu is offline Master of Nothing
    Windows XP Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Don't really understand what you want........

    I've a field in the table which shows which groups (from 15 groups) have been checked by the user.


    Group1 true
    Group2 true
    Group4 true
    Group7 true

    Etc

    There are some groups which may not have been checked and I want to show these on a form with checkboxes.
    Are the check boxes (ie "Group1") bound to fields in the table "Tbl"?

    If they are in a different table, linked by field "chkID", then you could use a main form/subform setup. No code necessary.

    You *could* post your dB for analysis.....

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


    This is the table. A row is added using an append query when a member of staff checks their group.

    I'd like to be able to look at the form below and see what's done. It currently works.



    Group names can change from year to year which doesn't help either. (Next year there not be a "7jk/mm1")

    Any questions will gladly be answered.


    Sent from my iPhone using Tapatalk

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

Similar Threads

  1. Replies: 6
    Last Post: 07-24-2015, 03:31 AM
  2. Replies: 7
    Last Post: 06-28-2015, 10:46 PM
  3. Replies: 7
    Last Post: 12-04-2013, 01:55 PM
  4. Replies: 2
    Last Post: 02-03-2013, 01:11 PM
  5. Replies: 3
    Last Post: 12-06-2011, 07:37 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