Nested IIf Statement

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Good Morning

I'm working on a Nested IIf Statement, I have resolved the first part, but I
am getting stuck when I add the second part.

Here's my IIf statement!

IIf(cable.FGLAND like 'H*',mid(cable.FGLAND, 2),cable.FGLAND,
(IIf(cable.TGLAND like 'H*',mid(cable.TGLAND, 2),cable.TGLAND)) AS
CONNECT_TYPE,

Thank you
 
Can you describe in one or more sentences what you would like to return with
this expression? Also, I would use
Left(cable.FGLAND,1) = 'H'
rather than
cable.FGLAND like 'H*'

Also, Mid() generally likes 3 arguments. If you ommit the last one, all the
characters are returned following the second argument. I assume this is what
you want.
 
Hello - my apolgies for the length of this explanation

I did look up the mid function to confirm that is what I want to use
Mid(string, start[, length]) - I just haven't put a length on the end

Here's what I want - I have two gland ends one of which might be hazardous
I'm required to show but I've just preceded the gland code by the letter H.
I don't want to show the H. If neither end is hazardous then I need to show
the glandcode from either the TGLAND or the FGLAND - which is the same
glandcode.

This part works
IIf(cable.FGLAND like 'H*',mid(cable.FGLAND, 2),cable.FGLAND) AS CONNECT_TYPE,

and it returned the values that I was expecting, but I need to make sure I
capture any hazardous gland ends from the TGLAND end.

regards,
 
IIf(cable.FGLAND like 'H*',mid(cable.FGLAND, 2),
IIf(cable.TGLAND like 'H*',mid(cable.TGLAND, 2),cable.TGLAND)) AS
CONNECT_TYPE

jkb66 said:
Hello - my apolgies for the length of this explanation

I did look up the mid function to confirm that is what I want to use
Mid(string, start[, length]) - I just haven't put a length on the end

Here's what I want - I have two gland ends one of which might be hazardous
I'm required to show but I've just preceded the gland code by the letter
H.
I don't want to show the H. If neither end is hazardous then I need to
show
the glandcode from either the TGLAND or the FGLAND - which is the same
glandcode.

This part works
IIf(cable.FGLAND like 'H*',mid(cable.FGLAND, 2),cable.FGLAND) AS
CONNECT_TYPE,

and it returned the values that I was expecting, but I need to make sure I
capture any hazardous gland ends from the TGLAND end.

regards,
--
jkb66


Duane Hookom said:
Can you describe in one or more sentences what you would like to return
with
this expression? Also, I would use
Left(cable.FGLAND,1) = 'H'
rather than
cable.FGLAND like 'H*'

Also, Mid() generally likes 3 arguments. If you ommit the last one, all
the
characters are returned following the second argument. I assume this is
what
you want.
 
How about just showing us some raw data and what you would expect to see in
your column?
Is it possible that both gland ends might be hazardous?

--
Duane Hookom
MS Access MVP
--

jkb66 said:
Hello - my apolgies for the length of this explanation

I did look up the mid function to confirm that is what I want to use
Mid(string, start[, length]) - I just haven't put a length on the end

Here's what I want - I have two gland ends one of which might be hazardous
I'm required to show but I've just preceded the gland code by the letter
H.
I don't want to show the H. If neither end is hazardous then I need to
show
the glandcode from either the TGLAND or the FGLAND - which is the same
glandcode.

This part works
IIf(cable.FGLAND like 'H*',mid(cable.FGLAND, 2),cable.FGLAND) AS
CONNECT_TYPE,

and it returned the values that I was expecting, but I need to make sure I
capture any hazardous gland ends from the TGLAND end.

regards,
--
jkb66


Duane Hookom said:
Can you describe in one or more sentences what you would like to return
with
this expression? Also, I would use
Left(cable.FGLAND,1) = 'H'
rather than
cable.FGLAND like 'H*'

Also, Mid() generally likes 3 arguments. If you ommit the last one, all
the
characters are returned following the second argument. I assume this is
what
you want.
 
I wanted to thank you for your all suggestions, I'm going to try and tackle
it with a switch function at this time. Which I can post if I have any luck.

cheers!
--
jkb66


Duane Hookom said:
How about just showing us some raw data and what you would expect to see in
your column?
Is it possible that both gland ends might be hazardous?

--
Duane Hookom
MS Access MVP
--

jkb66 said:
Hello - my apolgies for the length of this explanation

I did look up the mid function to confirm that is what I want to use
Mid(string, start[, length]) - I just haven't put a length on the end

Here's what I want - I have two gland ends one of which might be hazardous
I'm required to show but I've just preceded the gland code by the letter
H.
I don't want to show the H. If neither end is hazardous then I need to
show
the glandcode from either the TGLAND or the FGLAND - which is the same
glandcode.

This part works
IIf(cable.FGLAND like 'H*',mid(cable.FGLAND, 2),cable.FGLAND) AS
CONNECT_TYPE,

and it returned the values that I was expecting, but I need to make sure I
capture any hazardous gland ends from the TGLAND end.

regards,
--
jkb66


Duane Hookom said:
Can you describe in one or more sentences what you would like to return
with
this expression? Also, I would use
Left(cable.FGLAND,1) = 'H'
rather than
cable.FGLAND like 'H*'

Also, Mid() generally likes 3 arguments. If you ommit the last one, all
the
characters are returned following the second argument. I assume this is
what
you want.

--
Duane Hookom
MS Access MVP
--

Good Morning

I'm working on a Nested IIf Statement, I have resolved the first part,
but
I
am getting stuck when I add the second part.

Here's my IIf statement!

IIf(cable.FGLAND like 'H*',mid(cable.FGLAND, 2),cable.FGLAND,
(IIf(cable.TGLAND like 'H*',mid(cable.TGLAND, 2),cable.TGLAND)) AS
CONNECT_TYPE,

Thank you
 
Back
Top