Select All Checkboxes on filtered Records (1 Viewer)

gschimek

Registered User.
Local time
Today, 01:36
Joined
Oct 2, 2006
Messages
102
I'd like to know how to select a checkbox on all the records in a form's recordset at once. For example, I have a continuous form with a checkbox on each record that I want to use to select which records to print in a report. I plan to filter the form to only show the records I intend to print, and then have the "print" checkbox selected all at once by clicking a button or something similar. That way I don't have to manually select "print" on all the records.

It's similar to the way a web-based email system like Gmail works. Most of them allow you to "select all" and have all the messages checked, so that you can then move or delete them, etc.

Thanks in advance. Hopefully this is an easy one.
 

Exodus

Registered User.
Local time
Yesterday, 23:36
Joined
Dec 4, 2003
Messages
317
This is fairly simple I just did the same thing last week. Here is the code I am using.

gfsql in my code is declared globally. You will need to use the record source of your filtered data. After you run the report you will have to reset everything again.

Code:
Dim dbs As DAO.Database
Dim rst As DAO.Recordset

Me.PayRollOutput.Requery
Set dbs = CurrentDb()
    Set rst = dbs.OpenRecordset(gfsql, dbOpenDynaset)

With rst
.MoveFirst

Do Until .EOF

.Edit
!Processed = True
.Update

.MoveNext

Loop

End With
rst.Close

End Sub
 

Users who are viewing this thread

Top Bottom