IIf results based on a string value

  • Thread starter Thread starter Jacqueline
  • Start date Start date
J

Jacqueline

I need a text box to print a title based on a course title. I tried using a *
wildcard but that did not work. Then tried looking for the first character in
the string as all the classes that have a C in the first place of the title
are these classes. Here is the code I tried, can anyone set me on the right
path please?
Tried:
=IIf((Left([COURSE_TITLE]="C*","College Alternative Program"," ")
Also Tried:
=IIf((Left([COURSE_TITLE],1)="C","College Alternative Program"," ")
Thank you,
Jacqueline
 
The first one is wrong, but the second one should work.

What happens when you try it? Do you get an error? If so, what's the error?
If you don't get an error, what do you get?
 
The error message is:

The expression you entered has a function containing the wrong number or
arguments

I also tried inclosing the C in single quotes instead of double, got the
same message.
Thanks


Douglas J. Steele said:
The first one is wrong, but the second one should work.

What happens when you try it? Do you get an error? If so, what's the error?
If you don't get an error, what do you get?

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Jacqueline said:
I need a text box to print a title based on a course title. I tried using a
*
wildcard but that did not work. Then tried looking for the first character
in
the string as all the classes that have a C in the first place of the
title
are these classes. Here is the code I tried, can anyone set me on the
right
path please?
Tried:
=IIf((Left([COURSE_TITLE]="C*","College Alternative Program"," ")
Also Tried:
=IIf((Left([COURSE_TITLE],1)="C","College Alternative Program"," ")
Thank you,
Jacqueline
 
Too many opening parenthsis.
Not IIF((Left(....
but
IIF(Left(....


Jacqueline said:
The error message is:

The expression you entered has a function containing the wrong number or
arguments

I also tried inclosing the C in single quotes instead of double, got the
same message.
Thanks


Douglas J. Steele said:
The first one is wrong, but the second one should work.

What happens when you try it? Do you get an error? If so, what's the error?
If you don't get an error, what do you get?

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Jacqueline said:
I need a text box to print a title based on a course title. I tried using a
*
wildcard but that did not work. Then tried looking for the first character
in
the string as all the classes that have a C in the first place of the
title
are these classes. Here is the code I tried, can anyone set me on the
right
path please?
Tried:
=IIf((Left([COURSE_TITLE]="C*","College Alternative Program"," ")
Also Tried:
=IIf((Left([COURSE_TITLE],1)="C","College Alternative Program"," ")
Thank you,
Jacqueline
 
Thanks Karl, that worked. I hate it when I over-look something so simple...
Jacqueline



KARL DEWEY said:
Too many opening parenthsis.
Not IIF((Left(....
but
IIF(Left(....


Jacqueline said:
The error message is:

The expression you entered has a function containing the wrong number or
arguments

I also tried inclosing the C in single quotes instead of double, got the
same message.
Thanks


Douglas J. Steele said:
The first one is wrong, but the second one should work.

What happens when you try it? Do you get an error? If so, what's the error?
If you don't get an error, what do you get?

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


I need a text box to print a title based on a course title. I tried using a
*
wildcard but that did not work. Then tried looking for the first character
in
the string as all the classes that have a C in the first place of the
title
are these classes. Here is the code I tried, can anyone set me on the
right
path please?
Tried:
=IIf((Left([COURSE_TITLE]="C*","College Alternative Program"," ")
Also Tried:
=IIf((Left([COURSE_TITLE],1)="C","College Alternative Program"," ")
Thank you,
Jacqueline
 
Back
Top