IIf results based on a string value

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
 
D

Douglas J. Steele

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?
 
J

Jacqueline

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
 
K

KARL DEWEY

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
 
J

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
 

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