Using a checkbox to further filter a SQL search on a Continuous Form (1 Viewer)

Digi

Registered User.
Local time
Today, 16:41
Joined
May 3, 2019
Messages
10
Hi,

Hoping I can phrase this correctly!

I have a table with customer details for a comment log. I have created a subform setup as a continuous form so that a Query brings back all the customers but it then has a criteria in the month column so it brings back results filtering by the month, so if it is June only comments logged in June appear.

The subform is then in another form so that I could add a search button to allow me to search and filter the continous subform to narrow down the records. It all works great and hopefully makes sense! I have a further field in the table that is a yes / no field to say if the comment log has been closed.

I am trying to add a checkbox somewhere so that if the box is checked it will show all records, closed or not closed, keeping the criteria for only showing those results for the month. If it is unchecked then it will only show the open logs again just for that month.

My knowledge of Access isn't great and I've kind of stumbled my way through setting up the first search, but can't figure this part out. Any help is appreciated. If none of this makes sense I can try and clarify.

Thansk, Si.
 

Ranman256

Well-known member
Local time
Today, 11:41
Joined
Apr 9, 2015
Messages
4,337
The check box afterupdate event, change the query:
Code:
Sub chkbox_afterupdate()
If chkBox.value then 
   Me.recordsource = "qsAllRecs"
Else
   Me.recordsource = "qsFilterRecs"
End if
End sub
 

Digi

Registered User.
Local time
Today, 16:41
Joined
May 3, 2019
Messages
10
That's great thanks.
 

Users who are viewing this thread

Top Bottom