Expressions

P

Pompey_Boy

Hi can anyone help with this:

I'm trying to use an IIf Between and And statement to work out
curriculum levels ie if between 1 and 4 then show '3c' if between 5
and 8 then show '3b' and so on, I've got the first bit working ok, but
if I then and a '+ IIf'and do the next one, I get an error.
 
G

Graham R Seach

You can use the IIf(), Choose(), or Switch() functions:

IIf(intNumber >=1 And intNumber <=4, "3c",IIf(intNumber >=5 And intNumber
<=8, "3b", "3a"))

Choose(intNumber,"3c","3c","3c","3c","3b","3b","3b","3b","3a")

Switch(intNumber >=1 And intNumber <=4, "3c",intNumber >=5 And intNumber
<=8, "3b", intNumber >=9, "3a")

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
 
G

Gijs Beukenoot

From Pompey_Boy :
Hi can anyone help with this:

I'm trying to use an IIf Between and And statement to work out
curriculum levels ie if between 1 and 4 then show '3c' if between 5
and 8 then show '3b' and so on, I've got the first bit working ok, but
if I then and a '+ IIf'and do the next one, I get an error.

Is this wat you mean?
IIF( <currilcumValue> between 1 and 4, "3c", IIF( <curriculumValue>
between 5 and 8, "3b", <FalseValueOrFunction>))
 
Top