using len & IIf statement

D

Donna

I have a field in a query as follows:

GCRS: IIf(Len([combined]>3),Right([combined],3),"")

When I run the query I get #Error all the way down the query. What am I
doing wrong?

What I'm trying to get is if the field [combined] has more than 3 characters
in it, I want the field GCRS to display the last 3 characters of the
[combined] field, or else just be blank
 
R

Rick Brandt

Donna said:
I have a field in a query as follows:

GCRS: IIf(Len([combined]>3),Right([combined],3),"")

When I run the query I get #Error all the way down the query. What am I
doing wrong?

What I'm trying to get is if the field [combined] has more than 3 characters
in it, I want the field GCRS to display the last 3 characters of the
[combined] field, or else just be blank

Your syntax is wrong. The closing ) on the Len() function needs to be before the
 
T

tina

Donna, please don't multi-post (the same question separately to different
newsgroups). Your question was already answered in .queries newsgroup before
Rick got to it here. if you had cross-posted, or preferrably posted to one
newsgroup only, he could have saved himself the trouble.


Rick Brandt said:
Donna said:
I have a field in a query as follows:

GCRS: IIf(Len([combined]>3),Right([combined],3),"")

When I run the query I get #Error all the way down the query. What am I
doing wrong?

What I'm trying to get is if the field [combined] has more than 3 characters
in it, I want the field GCRS to display the last 3 characters of the
[combined] field, or else just be blank

Your syntax is wrong. The closing ) on the Len() function needs to be before the
operator.
 
S

Shomad

tina said:
Donna, please don't multi-post (the same question separately to different
newsgroups). Your question was already answered in .queries newsgroup before
Rick got to it here. if you had cross-posted, or preferrably posted to one
newsgroup only, he could have saved himself the trouble.


Rick Brandt said:
Donna said:
I have a field in a query as follows:

GCRS: IIf(Len([combined]>3),Right([combined],3),"")

When I run the query I get #Error all the way down the query. What
am
I
doing wrong?

What I'm trying to get is if the field [combined] has more than 3 characters
in it, I want the field GCRS to display the last 3 characters of the
[combined] field, or else just be blank

Your syntax is wrong. The closing ) on the Len() function needs to be before the
operator.
 
D

Donna

The only reason I posted it twice was because the first time I had chosen the
area "Query" and didn't notice that it changed back to the default of
Import/Export Data when I went to type the new question. Sometimes it keeps
the area I have chosen & other times it doesn't - so I wanted to be sure it
posted to the correct area. They should have a way for us to delete our
questions if we feel we made a mistake.

Shomad said:
tina said:
Donna, please don't multi-post (the same question separately to different
newsgroups). Your question was already answered in .queries newsgroup before
Rick got to it here. if you had cross-posted, or preferrably posted to one
newsgroup only, he could have saved himself the trouble.


Rick Brandt said:
I have a field in a query as follows:

GCRS: IIf(Len([combined]>3),Right([combined],3),"")

When I run the query I get #Error all the way down the query. What
am
I
doing wrong?

What I'm trying to get is if the field [combined] has more than 3 characters
in it, I want the field GCRS to display the last 3 characters of the
[combined] field, or else just be blank

Your syntax is wrong. The closing ) on the Len() function needs to be before the
operator.
 
D

Donna

please see the reply I posted to "Shomad". THere should be a way for us to
delete our own questions before answeres are posted, if we feel we made a
mistake or if we finally figured it out on our own.

tina said:
Donna, please don't multi-post (the same question separately to different
newsgroups). Your question was already answered in .queries newsgroup before
Rick got to it here. if you had cross-posted, or preferrably posted to one
newsgroup only, he could have saved himself the trouble.


Rick Brandt said:
Donna said:
I have a field in a query as follows:

GCRS: IIf(Len([combined]>3),Right([combined],3),"")

When I run the query I get #Error all the way down the query. What am I
doing wrong?

What I'm trying to get is if the field [combined] has more than 3 characters
in it, I want the field GCRS to display the last 3 characters of the
[combined] field, or else just be blank

Your syntax is wrong. The closing ) on the Len() function needs to be before the
operator.
 
T

tina

the simple solution is for you to post an immediate "reply" to your own
post, with "SOLVED" in the subject line, or "Sorry - posted to another
newsgroup", etc. people would appreciate the courtesy.


Donna said:
The only reason I posted it twice was because the first time I had chosen the
area "Query" and didn't notice that it changed back to the default of
Import/Export Data when I went to type the new question. Sometimes it keeps
the area I have chosen & other times it doesn't - so I wanted to be sure it
posted to the correct area. They should have a way for us to delete our
questions if we feel we made a mistake.

Shomad said:
tina said:
Donna, please don't multi-post (the same question separately to different
newsgroups). Your question was already answered in .queries newsgroup before
Rick got to it here. if you had cross-posted, or preferrably posted to one
newsgroup only, he could have saved himself the trouble.


I have a field in a query as follows:

GCRS: IIf(Len([combined]>3),Right([combined],3),"")

When I run the query I get #Error all the way down the query.
What
am
I
doing wrong?

What I'm trying to get is if the field [combined] has more than 3
characters
in it, I want the field GCRS to display the last 3 characters of the
[combined] field, or else just be blank

Your syntax is wrong. The closing ) on the Len() function needs to be
before the
operator.
 
W

wuyonren

Donna said:
I have a field in a query as follows:

GCRS: IIf(Len([combined]>3),Right([combined],3),"")

When I run the query I get #Error all the way down the query. What am I
doing wrong?

What I'm trying to get is if the field [combined] has more than 3 characters
in it, I want the field GCRS to display the last 3 characters of the
[combined] field, or else just be blank
 

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