Get Brackets [ ] around Strings In NESTED IIF

G

Guest

I'm trying to do a nested IIF in a report (see below) to ouput text based on
the value of what is contained in a field called TalkNumber. TalkNumber is a
numeric field. However, Access keeps putting brackets around the text in the
expression and it causes me to get prompted for input. In plain English,
what I'm trying to code into the field is:

If TalkNumber=1, then print "IN" else, If TalkNumber=5, then print "SQ"
else, If Talknumber=6, then print "BH"

Seems simple enough, but Access keeps putting brackets around whatever I
have in quotes. Any suggestions? Below is the actual expression I'm putting
into the field.

=IIf([TalkNumber]=1,â€INâ€,IIf([TalkNumber]=5,"SQ",IIf([TalkNumber]=6,â€Bâ€)))
 
D

Duane Hookom

This looks ok:
=IIf([TalkNumber]=1,"IN",IIf([TalkNumber]=5,"SQ",IIf([TalkNumber]=6,"B")))
Are you suggesting you think this is wrong or does the expression get
changed to something else? If so, what exactly do you enter and what exactly
does it get changed to?
 
G

Guest

When I put it into the Properties, Access changes it thusly:

=IIf([TalkNumber]=1,[â€INâ€],IIf([TalkNumber]=5,"SQ",IIf([TalkNumber]=6,[â€BHâ€],[â€â€])))

Note the brackets around EVERYTHING enclosed in quotes. So what happens is
I get prompted for input for "IN".


Duane Hookom said:
This looks ok:
=IIf([TalkNumber]=1,"IN",IIf([TalkNumber]=5,"SQ",IIf([TalkNumber]=6,"B")))
Are you suggesting you think this is wrong or does the expression get
changed to something else? If so, what exactly do you enter and what exactly
does it get changed to?

--
Duane Hookom
MS Access MVP

DS said:
I'm trying to do a nested IIF in a report (see below) to ouput text based
on
the value of what is contained in a field called TalkNumber. TalkNumber
is a
numeric field. However, Access keeps putting brackets around the text in
the
expression and it causes me to get prompted for input. In plain English,
what I'm trying to code into the field is:

If TalkNumber=1, then print "IN" else, If TalkNumber=5, then print "SQ"
else, If Talknumber=6, then print "BH"

Seems simple enough, but Access keeps putting brackets around whatever I
have in quotes. Any suggestions? Below is the actual expression I'm
putting
into the field.

=IIf([TalkNumber]=1,"IN",IIf([TalkNumber]=5,"SQ",IIf([TalkNumber]=6,"B")))
 
G

Guest

FYI - I have this expression contained in a text box in the report.

Duane Hookom said:
This looks ok:
=IIf([TalkNumber]=1,"IN",IIf([TalkNumber]=5,"SQ",IIf([TalkNumber]=6,"B")))
Are you suggesting you think this is wrong or does the expression get
changed to something else? If so, what exactly do you enter and what exactly
does it get changed to?

--
Duane Hookom
MS Access MVP

DS said:
I'm trying to do a nested IIF in a report (see below) to ouput text based
on
the value of what is contained in a field called TalkNumber. TalkNumber
is a
numeric field. However, Access keeps putting brackets around the text in
the
expression and it causes me to get prompted for input. In plain English,
what I'm trying to code into the field is:

If TalkNumber=1, then print "IN" else, If TalkNumber=5, then print "SQ"
else, If Talknumber=6, then print "BH"

Seems simple enough, but Access keeps putting brackets around whatever I
have in quotes. Any suggestions? Below is the actual expression I'm
putting
into the field.

=IIf([TalkNumber]=1,"IN",IIf([TalkNumber]=5,"SQ",IIf([TalkNumber]=6,"B")))
 
D

Duane Hookom

Did you copy and paste this from Word or someplace? Your quotes aren't all
the same. The weird quotes around IN and BH aren't being read as quotes
since they aren't the same as the quotes around SQ. I expect the expression
might have been copied from some other application.

--
Duane Hookom
MS Access MVP

DS said:
When I put it into the Properties, Access changes it thusly:

=IIf([TalkNumber]=1,["IN"],IIf([TalkNumber]=5,"SQ",IIf([TalkNumber]=6,["BH"],[""])))

Note the brackets around EVERYTHING enclosed in quotes. So what happens
is
I get prompted for input for "IN".


Duane Hookom said:
This looks ok:
=IIf([TalkNumber]=1,"IN",IIf([TalkNumber]=5,"SQ",IIf([TalkNumber]=6,"B")))
Are you suggesting you think this is wrong or does the expression get
changed to something else? If so, what exactly do you enter and what
exactly
does it get changed to?

--
Duane Hookom
MS Access MVP

DS said:
I'm trying to do a nested IIF in a report (see below) to ouput text
based
on
the value of what is contained in a field called TalkNumber.
TalkNumber
is a
numeric field. However, Access keeps putting brackets around the text
in
the
expression and it causes me to get prompted for input. In plain
English,
what I'm trying to code into the field is:

If TalkNumber=1, then print "IN" else, If TalkNumber=5, then print "SQ"
else, If Talknumber=6, then print "BH"

Seems simple enough, but Access keeps putting brackets around whatever
I
have in quotes. Any suggestions? Below is the actual expression I'm
putting
into the field.

=IIf([TalkNumber]=1,"IN",IIf([TalkNumber]=5,"SQ",IIf([TalkNumber]=6,"B")))
 
G

Guest

Yes, that is the case. I did a cut-n-paste from MS Word. Are you
recommending typing it out instead?

Duane Hookom said:
Did you copy and paste this from Word or someplace? Your quotes aren't all
the same. The weird quotes around IN and BH aren't being read as quotes
since they aren't the same as the quotes around SQ. I expect the expression
might have been copied from some other application.

--
Duane Hookom
MS Access MVP

DS said:
When I put it into the Properties, Access changes it thusly:

=IIf([TalkNumber]=1,["IN"],IIf([TalkNumber]=5,"SQ",IIf([TalkNumber]=6,["BH"],[""])))

Note the brackets around EVERYTHING enclosed in quotes. So what happens
is
I get prompted for input for "IN".


Duane Hookom said:
This looks ok:
=IIf([TalkNumber]=1,"IN",IIf([TalkNumber]=5,"SQ",IIf([TalkNumber]=6,"B")))
Are you suggesting you think this is wrong or does the expression get
changed to something else? If so, what exactly do you enter and what
exactly
does it get changed to?

--
Duane Hookom
MS Access MVP

I'm trying to do a nested IIF in a report (see below) to ouput text
based
on
the value of what is contained in a field called TalkNumber.
TalkNumber
is a
numeric field. However, Access keeps putting brackets around the text
in
the
expression and it causes me to get prompted for input. In plain
English,
what I'm trying to code into the field is:

If TalkNumber=1, then print "IN" else, If TalkNumber=5, then print "SQ"
else, If Talknumber=6, then print "BH"

Seems simple enough, but Access keeps putting brackets around whatever
I
have in quotes. Any suggestions? Below is the actual expression I'm
putting
into the field.

=IIf([TalkNumber]=1,"IN",IIf([TalkNumber]=5,"SQ",IIf([TalkNumber]=6,"B")))
 
G

Guest

Duane, you da MAN! That was an OUTSTANDING catch! I typed it in from
scratch and it functioned just fine. I've seen your name on the boards and
for sure, you DEFINITELY know your stuff! THANK YOU!!! It was driving me
crazy!

Duane Hookom said:
Did you copy and paste this from Word or someplace? Your quotes aren't all
the same. The weird quotes around IN and BH aren't being read as quotes
since they aren't the same as the quotes around SQ. I expect the expression
might have been copied from some other application.

--
Duane Hookom
MS Access MVP

DS said:
When I put it into the Properties, Access changes it thusly:

=IIf([TalkNumber]=1,["IN"],IIf([TalkNumber]=5,"SQ",IIf([TalkNumber]=6,["BH"],[""])))

Note the brackets around EVERYTHING enclosed in quotes. So what happens
is
I get prompted for input for "IN".


Duane Hookom said:
This looks ok:
=IIf([TalkNumber]=1,"IN",IIf([TalkNumber]=5,"SQ",IIf([TalkNumber]=6,"B")))
Are you suggesting you think this is wrong or does the expression get
changed to something else? If so, what exactly do you enter and what
exactly
does it get changed to?

--
Duane Hookom
MS Access MVP

I'm trying to do a nested IIF in a report (see below) to ouput text
based
on
the value of what is contained in a field called TalkNumber.
TalkNumber
is a
numeric field. However, Access keeps putting brackets around the text
in
the
expression and it causes me to get prompted for input. In plain
English,
what I'm trying to code into the field is:

If TalkNumber=1, then print "IN" else, If TalkNumber=5, then print "SQ"
else, If Talknumber=6, then print "BH"

Seems simple enough, but Access keeps putting brackets around whatever
I
have in quotes. Any suggestions? Below is the actual expression I'm
putting
into the field.

=IIf([TalkNumber]=1,"IN",IIf([TalkNumber]=5,"SQ",IIf([TalkNumber]=6,"B")))
 

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

Top