Paul, I think your abilities have outgrown the usefulness of the
Filter-By-Form (FBF) interface.
There are several issues with FBF, such as the one you hightlight. A more
severe one is that it does not work with an MDE file. That means FBF is not
a viable approach if you are writing databases for other people to use,
since the MDE is highly desirable to prevent people fiddling with or
accidentally decompiling (and so corrupting) your application.
When you reassign a form's RecordSource, you also need to guard against
having text boxes bound to fields that disappear (no longer in new
recordsource) or change type (especially relevant for calculated fields).
Access seems to evaluate the fields and their data types when the form
opens, so if things disappear or change type later, you can easily crash
Access (and possibly corrupt your mdb).
What we tend to do is to provide unbound text/combo boxes in the Form Header
section, with command buttons for Filter and RemoveFilter. These are
constantly available, more intuitive that FBF, and also allow to to avoid
some of the many Filter bugs in Access.
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users -
http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"Paul Mars" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> Form can be opened with several different RecordSources as:
>
> DoCmd.OpenForm "MainData"
> Forms!MainData.RecordSource = "RecordsAddress"
>
> DoCmd.OpenForm "MainData"
> Forms!MainData.RecordSource = "RecordsAddressChildren"
>
> DoCmd.OpenForm "MainData"
> 'default RecordSource is AllRecords
>
> When click "Filter By Form" on toolbar, the dropdown choice for each Form
> control displays all values from the original Form RecordSource
> "AllRecords". Although, if a value is selected that does not exist in the
> current recordSource, it will not display when "Apply Filter".
>
> I need the dropdown choices to be limited to the current RecordSource. How
> can I do this?
>
> tks,
> Paul