form control

S

Steve

Hello

i have query with a field called 'consultant' the query runs via critieria
from a 'form' list box i.e.
[forms]![form1]![consultant] (this sits in the criteria field in the query)

how do i get this to pick up mulitiply enteries in the listbox or (text box)
like
John OR dave because at the moment it will only pick up one entry




Thanks Steve
 
A

Allen Browne

You will need some code to loop through the ItemsSelected collection of the
multi-select list box, and build the Filter/WhereCondition.

Here's an example of how to do it:
Use a multi-select list box to filter a report
at:
http://allenbrowne.com/ser-50.html

That example applies the string to the WhereCondition of a report, but the
process is identical to apply it to the Filter of a form.
 
S

Steve

would it be easier to use a text box then? and then reference it through the
query!
--
Thanks Steve


Allen Browne said:
You will need some code to loop through the ItemsSelected collection of the
multi-select list box, and build the Filter/WhereCondition.

Here's an example of how to do it:
Use a multi-select list box to filter a report
at:
http://allenbrowne.com/ser-50.html

That example applies the string to the WhereCondition of a report, but the
process is identical to apply it to the Filter of a form.

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.
Steve said:
i have query with a field called 'consultant' the query runs via critieria
from a 'form' list box i.e.
[forms]![form1]![consultant] (this sits in the criteria field in the
query)

how do i get this to pick up mulitiply enteries in the listbox or (text
box)
like
John OR dave because at the moment it will only pick up one entry
 
A

Allen Browne

Text box is fine for just one value (but so is a list box that is not
multi-select.)

If you want to put lots of value in a text box, you will have the same
issue. It must be parsed by splitting them into an array,and building the
WHERE clause.

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

Steve said:
would it be easier to use a text box then? and then reference it through
the
query!
--
Thanks Steve


Allen Browne said:
You will need some code to loop through the ItemsSelected collection of
the
multi-select list box, and build the Filter/WhereCondition.

Here's an example of how to do it:
Use a multi-select list box to filter a report
at:
http://allenbrowne.com/ser-50.html

That example applies the string to the WhereCondition of a report, but
the
process is identical to apply it to the Filter of a form.

Steve said:
i have query with a field called 'consultant' the query runs via
critieria
from a 'form' list box i.e.
[forms]![form1]![consultant] (this sits in the criteria field in the
query)

how do i get this to pick up mulitiply enteries in the listbox or (text
box)
like
John OR dave because at the moment it will only pick up one entry
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top