Parameter query - Using Choose function

  • Thread starter Thread starter davie_scott
  • Start date Start date
D

davie_scott

Guest
I need to allow a user to select criteria as part of a query.

Running the query manually I would type in either:

"Core Stock"
OR
<>"Core Stock"

in the criteria field of the column.

I tried using the following parameter in the design grid:

Choose([Select 1: Core Stock 2: Not Core Stock : ],"Core Stock",<>"Core Stock")

The "Core Stock" option works but the <>"Core Stock" returns no records.

I would prefer not to use a form if possible . Any ideas ?
Regards

David
 
Try
Choose([Select 1: Core Stock 2: Not Core Stock : ],"Core Stock","<>'Core Stock'")
 
Brian,

it didn't work,

Thanks David
 
Keep in mind, you are comparing string VALUES, not string CONDITIONS. This is key when you are trying to do query strings in condition boxes.

Instead of Choose, use the single-value Iif function return function.

My table is called tblProcessType, and the field is called ProcessTypeName. Replace these objects with your object names. Then paste the SQL string into the window, and open it in database design to see the differences.

SELECT tblProcessType.*, tblProcessType.ProcessTypeName
FROM tblProcessType
WHERE (((tblProcessType.ProcessTypeName)<>IIf([Select 1: Core Stock 2: Not Core Stock]=2,"Core Stock")))
OR (((tblProcessType.ProcessTypeName)=IIf([Select 1: Core Stock 2: Not Core Stock]=1,"Core Stock")));
 

Users who are viewing this thread

Back
Top Bottom