IIF statement

jmcmillan

New member
Local time
Today, 06:11
Joined
Oct 6, 2011
Messages
4
I need help with a simple IIF statement. I have two fields,
Code:
 and [RATE]. The I would like is if Code=8 then the Rate = 67.50.
 
Can someone help?
 
I need help with a simple IIF statement. I have two fields,
Code:
 and [RATE]. The I would like is if [COLOR=royalblue][B]Code=8[/B][/COLOR] then the [COLOR=seagreen][B]Rate = 67.50[/B][/COLOR].
 
Can someone help?[/QUOTE]
 
If you look up the format for the IIf() Statement, you will find that it is as follows: 
 
IIf([B][COLOR=royalblue]Condition to Test[/COLOR][/B], [COLOR=seagreen][B]Value if TRUE[/B][/COLOR], [COLOR=red][B]Value if FALSE[/B][/COLOR])
 
Place your parameters in the appropriate places, Select a value for FALSE, and you should get what you want.
 
Hi,

Is '8' the only option, or does
Code:
 have multiple options?
 
Hi,

Is '8' the only option, or does
Code:
 have multiple options?[/QUOTE]
 
You can use a compound IIF() statement or perhaps a SELECT CASE Statement to test more than one condition. Look up these statments and get back with any questions.
 
Can you give us more info?
How many combinations of Code and Rate do you have?
Should you be considering a Lookup table?
 
I am trying to place this in a query.
Code:
 has four possibilities:
 
1 = 67.50
2 = 50.00
8 = 51.75
10 = 36.00
 
When 1,2,8 or 10 is placed the Code filed I am trying to populate the rate field with the corresponding number, i.e, 67.50, 50.00, 51.75 or 36.00
 
Thanks for your consideration.
 
Please tell or show us the query you are trying to build.
You haven't given any table or field names other than Code and Rate.
 
The pdf you sent is a report. I was looking to see the underlying query that is the data source for the report.
 
You could create a table with the Code / Rates in them and add this to your existing query.

Simon
 
I agree with Simon. While There are ways to create an IIf() Statement or a SELECT CASE Block that will do what you want, a table has the advantage of leaving room for growth or modification without changing the program in any way.
 

Users who are viewing this thread

Back
Top Bottom