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.
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.
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.