IIf Statement

G

Guest

Here is the scenario. I have a list of numbers and due dates. I need to
create a query and an IIF statement. Here is what I have:

IIf(Right([number list],1)="1","12/31/2006")

number list
12-23121
32-12542
42-12541
52-12546
15-12544

Than I have due dates:
all numbers ending on "1" " and "6" due date is 12/31/2006
all numbers ending on "2" and "4" due date is 12/31/2007

How can I modify my Iff statement, so all the numbers ending in "1" and "6"
will have a due date of 12/31/2006?
 
G

Guest

Try something like

IIf(Right([number list],1) In ("1","6"),#12/31/2006#,#12/31/2007#)

Or

IIf(Right([number list],1) = "1" Or Right([number list],1) = "6"
,#12/31/2006#,#12/31/2007#)
 
T

Tom Ellison

Dear Gloria:

I don't see much system to the assignment of digits to years. I would shy
away from the IIf() as a solution usually.

But here's a way:

IIf(Right([number list], 1) IN ("1", "6"), "12/31/2006",
IIf(Right([number list], 1) IN ("2", "4"), "12/31/2007",
"some default"))

Perhaps this is a starting idea you might like.

Tom Ellison
 
G

Guest

Thanks for your help

Ofer said:
Try something like

IIf(Right([number list],1) In ("1","6"),#12/31/2006#,#12/31/2007#)

Or

IIf(Right([number list],1) = "1" Or Right([number list],1) = "6"
,#12/31/2006#,#12/31/2007#)
--
\\// Live Long and Prosper \\//
BS"D


Gloria said:
Here is the scenario. I have a list of numbers and due dates. I need to
create a query and an IIF statement. Here is what I have:

IIf(Right([number list],1)="1","12/31/2006")

number list
12-23121
32-12542
42-12541
52-12546
15-12544

Than I have due dates:
all numbers ending on "1" " and "6" due date is 12/31/2006
all numbers ending on "2" and "4" due date is 12/31/2007

How can I modify my Iff statement, so all the numbers ending in "1" and "6"
will have a due date of 12/31/2006?
 
G

Guest

Thanks for your help.

Tom Ellison said:
Dear Gloria:

I don't see much system to the assignment of digits to years. I would shy
away from the IIf() as a solution usually.

But here's a way:

IIf(Right([number list], 1) IN ("1", "6"), "12/31/2006",
IIf(Right([number list], 1) IN ("2", "4"), "12/31/2007",
"some default"))

Perhaps this is a starting idea you might like.

Tom Ellison


Gloria said:
Here is the scenario. I have a list of numbers and due dates. I need to
create a query and an IIF statement. Here is what I have:

IIf(Right([number list],1)="1","12/31/2006")

number list
12-23121
32-12542
42-12541
52-12546
15-12544

Than I have due dates:
all numbers ending on "1" " and "6" due date is 12/31/2006
all numbers ending on "2" and "4" due date is 12/31/2007

How can I modify my Iff statement, so all the numbers ending in "1" and
"6"
will have a due date of 12/31/2006?
 

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

Similar Threads


Top