passing criteria to query

dosia

Registered User.
Local time
Today, 11:17
Joined
Jan 29, 2014
Messages
15
I need to pass a criteria to a query from my option group control to my query.
It contains three options 1,2 and 3.

If option 3 then Pricing Type 1 and 2

How do I make the code below working?

IIf([Forms]![FrmUserSelection]![PricingType] Like 3,([dbo_AGPricingDiscounts].[PricingType])="2" Or ([dbo_AGPricingDiscounts].[PricingType])="1",",[Forms]![FrmUserSelection]![PricingType]")

Please any help appreciated.

Thanks
 
To pass the value from a control to a query (as Criteria):
In the Criteria Row of the query:
Forms!FormName.ControlName

I don't understand what you are trying to achieve with the code you showed to us.
 
Thanks, this is what I am just doing. My option values are 1 or 2 or 3
I need to select criteria of Pricing Type based on my option value selection. My pricing type in a database could be 1 or 2.
If option value 1 then I am passing Forms!FormName.ControlName (which is also 1) this would work fine
If option value 2 then I am passing Forms!FormName.ControlName (which is also 2) this would work fine

However if user selects option 2 than I need to select Pricing Type 1 and 2.
 
However if user selects option 2 than I need to select Pricing Type 1 and 2
I think that you mean 3
However if user selects option 3 than I need to select Pricing Type 1 and 2

Try this as Criteria
IIF(Forms!FormName.ControlName = 3, "1 Or 2" , Forms!FormName.ControlName)
or this
IIF(Forms!FormName.ControlName = "3", "1 Or 2" , Forms!FormName.ControlName)
 

Users who are viewing this thread

Back
Top Bottom