CheckBox on form

P

PawelR

Hello group,
I beginner in Access.
I have in database table with [boolean] colum - ColChose . I show this table
on form. On form I have to checkBox.
I want do this that if checkBox is checked show only record with ColChose is
true. If checkBox is unchecked show all rows.

thx. PawelR
 
A

Allen Browne

Add another check box to your form, and give it these properties:
Default Value No
Name chkFilterColChose
After Update [Event Procedure]
You must leave the Control Source blank.

Click the Build button (...) beside the After Update property.
Access opens a code window.
Between the "Private Sub..." and "End Sub lines paste:

If Me.Dirty Then 'Save before filter.
Me.Dirty = False
End If
If Me.chkFilterColChose.Value Then
Me.Filter = "ColChose = True"
Me.FilterOn = True
Else
Me.FilterOn = False
End If
 
Top