Solved

IIF looking at two different fields

Posted on 2011-03-23
5
387 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 - Access MVP) 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…

863 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now