Filter by checkbox for Report (1 Viewer)

mjreiman

Registered User.
Local time
Yesterday, 23:30
Joined
Jan 29, 2010
Messages
25
I have a timesheet table that I would like to display the Distinct WeekEndings, which is every saturday, with a checkbox next to them in a continuous forms view. Then I would like to create a report that displays the data only for the weeks with the checkboxes next to them in the form. I don't know if it's because I've been working all day, but I don't even know where to begin with it.

Matt
 

dkinley

Access Hack by Choice
Local time
Today, 01:30
Joined
Jul 29, 2008
Messages
2,016
Hi! I am not sure where or when you want this action to occur, but I'd suggest starting with something simple for testing purposes.

Suppose you created a command button control and placed it on the form header. Then, try this code behind the button ....

Code:
If Me.chkCheckBoxName = -1 Then
    Me.Filter= "([CheckBoxFieldName] = True)"
ElseIf Me.chkCheckBoxName = 0 Then
    Me.Filter= "([CheckBoxFieldName] = False)"
End If
 
Me.FilterOn = True

Substitute the 'chkCheckBoxName' for the control name of your check box and 'CheckBoxFieldName' to the field name of the Yes/No field of the table or query that populates the form.

You could set up another button beside/underneath/somewhere to turn off the filtering by setting the code to ...

Code:
Me.FilterOn = False

-dK

EDIT: I just read the bit where you want to make a report. I was proposing a solution to filter the form data. The query bit will be easier for the reporting method. Apologies.
 
Last edited:

vbaInet

AWF VIP
Local time
Today, 07:30
Joined
Jan 22, 2010
Messages
26,374
You may find this useful:

http://baldyweb.com/wherecondition.htm

Are you opening the report from the form? It may just be easier to create a query that selects all those YES values - because when you tick/uncheck the checkbox and move away from the control, it gets updated. Then base your report on that query.
 

mjreiman

Registered User.
Local time
Yesterday, 23:30
Joined
Jan 29, 2010
Messages
25
I don't know why I didn't think of that since almost all the reports in this DBMS are controlled by queries. Thanks a ton!

Matt
 

vbaInet

AWF VIP
Local time
Today, 07:30
Joined
Jan 22, 2010
Messages
26,374
Sometimes all you need is a little reminder and some ideas then you will get the "aaahhh" moment :)

Glad we could help.
 

Users who are viewing this thread

Top Bottom