Use the AfterUpdate event procedure of the unbound check box to execute an
Update query statement so that all the entries matching the form's filter
are set to Yes
Private Sub chk1_AfterUpdate
Dim strSql As String
If Me.chk1.Value And Me.FilterOn Then
If Me.Dirty Then 'Save first
Me.Dirty = False
End If
strSql = "UPDATE [Table1] SET Choice = True WHERE " & Me.Filter
dbEngine(0)(0).Execute strSql, dbFailOnError
End If
End Sub
To reset all boxes to unchecked again, execute this string:
strSql = "UPDATE [Table1] SET Choice = False WHERE Choice = True;"
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users -
http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>
> I have an unbound form name "Letter "
> On this form I have a continuous form named "frmEmployees" linked
> with the table "tblEmployees"
> In the continuous form I have many fields including "City" and
> "Choice" both linked with table "tblEmployees"
> Field "Choice" is a check box (yes/no)
>
> Suppose I make a filter on New-York city, I want to use a button placed
> on the from header of the "frmEmployees" that when I click on it
> all the check boxes "Choice" for New-York will become checked.
> Then I filter for Denver and by clicking the same button, all the
> "Choice" check boxes for Denver will be checked
> Of course I can check some other records if I want
> So at the end all check boxes for New-York all check boxes for Denver
> plus all other single boxes I have check are checked.
>
> I also want a second button that I will use to uncheck all check boxes.
>
> Thanks for helping me