Form Based Parameter Query

B

Bill

Hi All,

If I simply enter the values into the criteria on the QBE grid it would be
"1C" Or "2U" Or "3M", this works as intended.

However I need to be able to reproduce this criteria via a form. I am using
a list box to provide the criteria and it works with individual criteria
i.e. just "1C" but I cannot reproduce the OR statement within the list box
in a way that is correctly picked by the query.

If it makes any difference I am typing the value into the list box.

Any ideas please.

Ta.
Bill
 
B

Bill

Duane,

Thanks for the response but that is not doing what I require which is that
"1C" Or "2U" Or "3M" becomes the WHERE criteria.

Thanks anyway.
Bill.


Duane Hookom said:
There is a generic function for multi-select list boxes at
http://www.rogersaccesslibrary.com/OtherLibraries.asp#Hookom,Duane.]\

--
Duane Hookom
Microsoft Access MVP


Bill said:
Hi All,

If I simply enter the values into the criteria on the QBE grid it would
be
"1C" Or "2U" Or "3M", this works as intended.

However I need to be able to reproduce this criteria via a form. I am
using
a list box to provide the criteria and it works with individual criteria
i.e. just "1C" but I cannot reproduce the OR statement within the list
box
in a way that is correctly picked by the query.

If it makes any difference I am typing the value into the list box.

Any ideas please.

Ta.
Bill
 
G

Guest

You are using a multi-select list box to provide a filter to a query. That is
exactly what the function does. I am not aware of any method of using a
multi-select list box as a criteria without using code.

You could alternatively write code that loops through the selected items in
the list box and builds a where clause that can be used in the OpenReport or
OpenForm methods. You can also build and replace the entire SQL property of a
saved query.

--
Duane Hookom
Microsoft Access MVP


Bill said:
Duane,

Thanks for the response but that is not doing what I require which is that
"1C" Or "2U" Or "3M" becomes the WHERE criteria.

Thanks anyway.
Bill.


Duane Hookom said:
There is a generic function for multi-select list boxes at
http://www.rogersaccesslibrary.com/OtherLibraries.asp#Hookom,Duane.]\

--
Duane Hookom
Microsoft Access MVP


Bill said:
Hi All,

If I simply enter the values into the criteria on the QBE grid it would
be
"1C" Or "2U" Or "3M", this works as intended.

However I need to be able to reproduce this criteria via a form. I am
using
a list box to provide the criteria and it works with individual criteria
i.e. just "1C" but I cannot reproduce the OR statement within the list
box
in a way that is correctly picked by the query.

If it makes any difference I am typing the value into the list box.

Any ideas please.

Ta.
Bill
 

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