From: Deo on
Hello,

I have a combo box on a form that allows a user to select a location code
that is used by a query. I want to run the query for two location - 73 and
28 - if location 73 is selected otherwise just run for the location
selected. In my query criteria under location I have the following code
In (iif([Forms]![frmFinancial].[cboLoc].[value]
='73',('73','28'),[Forms]![frmFinancial].[cboLoc].[value])).
However this does not work. How do I get this to read the two values.

Thanks

Deo
From: John W. Vinson on
On Fri, 26 Feb 2010 13:55:01 -0800, Deo <Deo(a)discussions.microsoft.com> wrote:

>Hello,
>
>I have a combo box on a form that allows a user to select a location code
>that is used by a query. I want to run the query for two location - 73 and
>28 - if location 73 is selected otherwise just run for the location
>selected. In my query criteria under location I have the following code
>In (iif([Forms]![frmFinancial].[cboLoc].[value]
>='73',('73','28'),[Forms]![frmFinancial].[cboLoc].[value])).
>However this does not work. How do I get this to read the two values.
>
>Thanks
>
>Deo

You can only pass actual values with an IIF - not operators such as commas or
quotemarks.

Try instead using a criterion of

=[Forms]![frmFinancial].[cboLoc] OR ([Forms]![frmFinancial].[cboLoc] = 73 AND
[Location] IN ('73', '28'))

--

John W. Vinson [MVP]