Filtering a form by multiple values but in one field

petko

Registered User.
Local time
Today, 22:18
Joined
Jun 9, 2007
Messages
85
What I'm trying to do is probably an easy task but I need some help to do it.

I have a form, for example a form of customers. One of the fields of a customer is a city postal code. As a result of an independent external querie I have a bunch of postal codes on which I'd like to filter my form of customers. Is there a way I can do it automatically from a code? Number of postal codes can be as high as few hundreds.

Any idea is appreciated.

Peter
 
just a suggestion.
create a table with the a single field of codes you want to be included in the query.
based on this table create the query:

select field1, field2 from from table1 inner join [new table] on table1.[postal code] = [new table].[postal code];

or

select field1, field2 from from table1 where [postal code] in (select [postal code] from [new table]);
 
This is what I tried to do but then the form's fields are not editable anymore (as the rowsource's fields are not either...)
 
I tried arnelqp's queries (without the redundant from) and the both worked and are editable. The attached database demonstrates this. But to make his first example editable I had to give the Postal Code a unique index in the "new table". Not have a unique key in a relationship will typically make a recordset uneditable.

I suggest giving the Postal Code a unique index and going with the first suggestion as sometimes a WHERE IN in a query can make them pretty slow.
 

Attachments

Hi sneuberg, thanks for the example, works nice!

Peter
 

Users who are viewing this thread

Back
Top Bottom