I have a problem using the form .Filter and .FilterOn properties which
causes Access to crash (as detailed in a separate post). The form operates
in continuous mode, displaying matching records from a file based on a
search criterion. This basic functionality works just fine.
I decided to allow the user to narrow down the output by providing some
extra controls to allow the user to filter the recordset via the .Filter
form property. Any data entered into these extra controls is used to
generate a clasue suitable for the .Filter property. This also works fine
when the application of the filter reduces the number of records displayed.
The problem occurs when I subsequently update the filter data such that it
increases the number of records displayed, or even turn off the filter to
return the display to the full recordset -- Access crashes with the
familiar "Access has encountered a problem and needs to close...".
However, stepping through the code, it works just fine, so I know that the
filter clauses used are OK.
Some things I have already tried (to no avail):
* Setting the form's .Filter property directly with the filter clause;
* Using the DoCmd.ApplyFilter and DoCmd.ShowAllRecords commands
* Setting .FilterOn before and after setting the filter clause
I suspect that setting the .Filter property causes some events to trigger
asynchronously, and that this somehow conflicts with the execution of my
code. Perhaps you can only filter in such a way that it will reduce the
number of records displayed, and that you can't then change the filter such
that it will increase the number of displayed records (or turn off the
filter altogether)? To change the filtering such that it will increase the
number of displayed records (after the number of records has already been
decreased by filtering), perhaps it is necessary first to requery the
original recordset so that you start again with a full deck (so to speak)?
In other words, do I have a real problem -- or is there a restriction that
you can only filter down to a smaller set of records (and can't
subsequently "unfilter")?
I hope this makes some sense.
Thanks,
Lyn.