Connecting Tech Pros Worldwide Forums | Help | Site Map

Add filter to row source query of list box?

lorirobn
Guest
 
Posts: n/a
#1: May 29 '07
Hi,

I have a list box on a form, whose row source points to a separate
query. The query refers to a field on the form to filter records on
the list box, like such: WHERE tblA.DesignType = [Forms]![frmForm1]!
[txtDesignType]).

Now I want to put this list box on a second form. Rather than create
a second query that would reference a field on the second form, I want
to try to use the same query, and make it generic.

Is there a way to do this?

Can I take off the WHERE clause from the query, and put it somewhere
on the form? In other words, can I filter the query by adding a
filter to each of these two forms, to filter the list box?

I know I could put the query's SQL directly into the row source of the
form, but because it joins about 6 tables, I'd prefer to keep it
separate and easier to read.

Thanks in advance..
lorirobn


lgeastwood@gmail.com
Guest
 
Posts: n/a
#2: May 30 '07

re: Add filter to row source query of list box?


On May 29, 9:54 am, lorirobn <lorir...@yahoo.comwrote:
Quote:
Hi,
>
I have a list box on a form, whose row source points to a separate
query. The query refers to a field on the form to filter records on
the list box, like such: WHERE tblA.DesignType = [Forms]![frmForm1]!
[txtDesignType]).
>
Now I want to put this list box on a second form. Rather than create
a second query that would reference a field on the second form, I want
to try to use the same query, and make it generic.
>
Is there a way to do this?
>
Can I take off the WHERE clause from the query, and put it somewhere
on the form? In other words, can I filter the query by adding a
filter to each of these two forms, to filter the list box?
>
I know I could put the query's SQL directly into the row source of the
form, but because it joins about 6 tables, I'd prefer to keep it
separate and easier to read.
>
Thanks in advance..
lorirobn
put your textbox on a "common" form that you always have open and
update it as required for your filter. remember to requery the active
listbox

Closed Thread