Results 1 to 9 of 9
  1. #1
    d13rosew is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2015
    Posts
    5

    Select all for a checkbox

    I have a form that was created by another user long ago... I need to add a button that when clicked it checks all check boxes on the form. The form is currently per loaded by a different query. For this form when the user checks the box for each line items it will load a different table once you click a done button on the form. What is the best way to go about this. I am fairly new to this type of Access programming.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    What do you mean by 'all' checkboxes? There are multiple yes/no fields bound to checkbox controls? Or do you mean one field/checkbox and multiple records?

    I have no idea what you mean by 'load a different table'.
    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.

  3. #3
    d13rosew is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2015
    Posts
    5
    it is one field/checkbox and multiple records? By it loads a different table I am talking about that is the box next to the record is checked a different table is loaded with the other data in the form. If the checkbox is not checked then no data is loaded.

    Thank you for any guidance you can provide.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Load data from table to where? Why would data come from various different tables?

    Is this checkbox unbound? An unbound control will show the same value for all records.

    Sorry, still not making sense to me.
    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.

  5. #5
    d13rosew is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2015
    Posts
    5
    Sorry, i'm not very fimilar with this database as I didn't create it and i'm trying to fix the issues in it. So i'm having to do a lot of digging to find how it was set up. This might help the code attached to the checkbox on the form is below. I want to have all the records that are loaded be loaded as checked so the user doesn't have to go and check them all one at a time. I hope this helps

    Private Sub chkCompleted_Click()
    If Me.chkCompleted = -1 Then
    Me.txtNMFCancelDate = Date
    Else
    Me.txtNMFCancelDate = Null
    End If
    End Sub

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    That code has nothing to do with setting the checkbox. It is only triggered when the checkbox is clicked. And the code sets value in txtNMFCancelDate.

    So what you really seem to want is to set value in txtNMFCancelDate.

    Simplest way to do this is with an UPDATE sql action. What is the identifier that relates these records? Something like:

    CurrentDb.Execute "UPDATE tablename SET fieldname=Date() WHERE ID=" & Me!ID

    Then refresh the form with Me.Refresh.

    However, real trick is figuring out what event to put the code in.
    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.

  7. #7
    d13rosew is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2015
    Posts
    5
    Thank you this helps a lot. There are a lot of rabbit holes i'm running down on this database. Wouldn't it be easier just to add a button function to click and make all the checkboxes checked? That is what I was hoping would be the fastest solution but i'm having trouble making that happen.... I've never set up a "check all" type of button before.

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    The UPDATE action is still easiest and can be in the button Click event. Checking each record would require looping code. And programmatically setting the checkbox will not set value in the date textbox.
    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.

  9. #9
    d13rosew is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2015
    Posts
    5
    Ok, thank you for all your time

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

Similar Threads

  1. Replies: 1
    Last Post: 11-26-2014, 02:30 PM
  2. Replies: 5
    Last Post: 05-14-2014, 01:17 PM
  3. Multi-select checkbox
    By Access_Novice in forum Forms
    Replies: 1
    Last Post: 01-08-2014, 01:44 AM
  4. Select All/ Clear All checkbox
    By TheHarleygirl2005 in forum Forms
    Replies: 11
    Last Post: 01-15-2013, 03:21 PM
  5. Replies: 3
    Last Post: 05-15-2011, 10:52 PM

Tags for this Thread

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