Selecting all Check Boxes on a Continuous
This tip will show you how to make a command button that checks all records using a check box that we will call [Include].
To do this:
Add a command button to the form without using the wizard, and then to the 'On Click' event add the following code (below the (***):
This code creates a copy of the records populating the form (recordsetclone). It then moves to the first record and changes the text box [Include] value to -1 (=True or Yes), it then moves to the next record and so on, until it reaches the end of the recordset (EOF = End Of File). The form is then re-queried so that the ticks are displayed in the check boxes.
On Error GoTo ErrorHandler
Dim db As Object
Dim rst As Object
Set db = Application.CurrentDb
Set rst = Me.RecordsetClone
Do Until rst.EOF
rst!Include = -1
MsgBox "Error Number: " & err.Number & " " & err.Description
Change ‘Include’ to the name of your check box.
You may need to reference DAO, see the following:
Kirstie add a link for the following.
Do you like this tip? Subscribe to my free weekly Newsletter to receive tips weekly via email. Click Here to subscribe.