
Originally Posted by
anoob
This is probably a stupid question.
I have an ApplyFilter action applied to a button - lets just say it shows all expenses from a table - but is there a way to make this ONLY apply to the current filtered records the form is showing?
For example, if I have 100 transactions in 2010 and I filter out all the transactions between July and December. Not I have 50 records showing.
Is there a way to make my my filter expenses action filter the 50 remaining records?
No.
There are two ways to select records for a form. The first is to use all records in a table or query (say 150). Then set a filter to limit the records displayed. If you want to do additional filtering, you have to get the current filter, then add the new filter condition. For example, if the filter is
Code:
TransDate between #7/1/2010# and #12/31/2010#
and you want to have an additional filter of expenses >0, the filter statement would be
Code:
([TransDate] Between #7/1/2010# and #12/31/2010#) AND [Expenses] >0
The base number of records is still 150.
The second way is to limit the records returned to the form. Instead of returning all records, the WHERE clause for the query would be
Code:
WHERE [TransDate] Between #7/1/2010# And #12/31/2010#
Instead of returning 150 records (see above), the where clause would limit the records returned to 100. Then, if you wanted to filter by expenses >0, the filter string would only be
.
.
I know this is a forum but sorry for all the questions - this is saving me so much time though and I appreciate all the feedback.
Actually, that is what this forum is for - to answer questions about Access.