Solved

IIF looking at two different fields

Posted on 2011-03-23
5
393 Views
Last Modified: 2012-05-11
I need to use an IIF that looks at two fields as in:

Expr2: IIf((Len([phone#])=7) And Mid$([TextField],1,4)='CRED',result1,result2)

all I get is result2
0
Comment
Question by:stirus
5 Comments
 
LVL 75

Accepted Solution

by:
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform) earned 42 total points
ID: 35200772
Try with double quotes:
Expr2: IIf((Len([phone#])=7) And Mid$([TextField],1,4) = "CRED",result1,result2)

But are you SURE the condition is actually being met?

mx
0
 
LVL 77

Assisted Solution

by:peter57r
peter57r earned 42 total points
ID: 35200826
I agree with mx's last comment.

I think you are misreading your data.

Add the expressions temporarily as extra columns and see..

mylen:Len([phone#])

mymid: Mid$([TextField],1,4)
0
 
LVL 44

Assisted Solution

by:GRayL
GRayL earned 41 total points
ID: 35200959
Try this.  I moved the parentheses:

IIf((Len([phone#])=7 And Mid$([TextField],1,4)="CRED"),result1,result2)
0
 

Author Closing Comment

by:stirus
ID: 35201006
all three helped.  Thanks
0
 
LVL 44

Expert Comment

by:GRayL
ID: 35201275
Thanks, glad to help.  Can you post Expr2 as you now have it?
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question