Go Back   Access World Forums > Microsoft Access Discussion > Forms

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 01-10-2019, 08:50 AM   #1
vhanus2
Newly Registered User
 
Join Date: Aug 2018
Posts: 10
Thanks: 1
Thanked 0 Times in 0 Posts
vhanus2 is on a distinguished road
Filtering Forms on a checkbox

Hello everyone,

Im currently working on a database, and im trying to filter on when a checkbox is marked as false; however the filter only works on true. When changing to false, it gives me a invalid call procedure.

This is my SQL if it helps:
Quote:
SELECT tblBoxNumbers.ID, tblBoxNumbers.IronMountainID, [tblRecord Departmenttype].RecordType, tblDocumentTypes.DocType, tblBoxNumbers.[SenttoDestroy?], tblBoxNumbers.EmailsentDate, DateAdd("yyyy",[tblDocumentTypes]![Years],[tblBoxNumbers]![DocumentDate]) AS Expr1, tblBoxNumbers.DocumentDate
FROM [tblRecord Departmenttype] INNER JOIN (tblDocumentTypes INNER JOIN tblBoxNumbers ON tblDocumentTypes.DocumentTypeID = tblBoxNumbers.DocumentTypeID) ON [tblRecord Departmenttype].RecordTypeID = tblBoxNumbers.RecordTypeID
WHERE (((tblBoxNumbers.[SenttoDestroy?])=True) AND ((DateAdd("yyyy",[tblDocumentTypes]![Years],[tblBoxNumbers]![DocumentDate]))<Date()));
Any help would be appreciated!

vhanus2 is offline   Reply With Quote
Old 01-10-2019, 09:00 AM   #2
Ranman256
Newly Registered User
 
Join Date: Apr 2015
Location: KY,USA
Posts: 3,367
Thanks: 0
Thanked 742 Times in 727 Posts
Ranman256 will become famous soon enough Ranman256 will become famous soon enough
Re: Filtering Forms on a checkbox

have the form show all records, but filter on the checkbox value

Code:
sub chkBox_Afterupdate()
me.filter = "[Field]=" & me.chkBox.value
me.filterOn = true
end sub

'default at load
sub form_load()
me.filter = "[Field]=true"
me.filterOn = true
end sub
Ranman256 is offline   Reply With Quote
Old 01-10-2019, 09:19 AM   #3
bastanu
Registered User
 
Join Date: Apr 2010
Location: Kelowna, Canada
Posts: 242
Thanks: 1
Thanked 69 Times in 67 Posts
bastanu is on a distinguished road
Re: Filtering Forms on a checkbox

I take it you don't really want to "filter" but you want to limit your query results using a criteria on your boolean (Yes/No) field [SentToDestryo?], is that correct? Do you actually have data that would satisfy the conditions ([SentToDestroy?]=False and dateinfuture<Today)? Where is the query(SQL statement) used, in VBA, as a record source for a form, report???

Cheers,
Vlad

bastanu is offline   Reply With Quote
Old 01-10-2019, 10:46 AM   #4
vhanus2
Newly Registered User
 
Join Date: Aug 2018
Posts: 10
Thanks: 1
Thanked 0 Times in 0 Posts
vhanus2 is on a distinguished road
Re: Filtering Forms on a checkbox

Hi Vlad,

I originally had this as a filter on load, but i recently opened my form and it seams as though it does not work. I have tried it as a filter on load, in the record set of the form, SQL, and as a toggle filter.

There is data that supports the field as a no/false; however it does not show when trying to have only those that are viewed.
vhanus2 is offline   Reply With Quote
Old 01-10-2019, 11:01 AM   #5
bastanu
Registered User
 
Join Date: Apr 2010
Location: Kelowna, Canada
Posts: 242
Thanks: 1
Thanked 69 Times in 67 Posts
bastanu is on a distinguished road
Re: Filtering Forms on a checkbox

What happens if you hard-code it in the record source of the form (remove all filters on both query and form and set it as a criteria in the query that is used as the record source of the form)?

Cheers,
Vlad

bastanu is offline   Reply With Quote
Reply

Tags
checkbox , filter , forms

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Filtering form with checkbox serose14 Forms 3 10-30-2015 12:49 PM
Filtering Form by Checkbox JPed Forms 2 02-28-2014 04:49 AM
Filtering records with multiple checkbox in form Lennon Forms 4 02-24-2012 04:47 AM
Checkbox in forms adi.shoukat Forms 5 02-25-2010 02:42 AM
filtering report via checkbox selection in a form pavol_b Forms 0 05-26-2005 07:55 AM




All times are GMT -8. The time now is 03:29 PM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Featured Forum post


Sponsored Links


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World