Solved

Iif Isnull problem

Posted on 2009-04-05
5
859 Views
Last Modified: 2013-11-28
I've got a union query with the field [city]. Im tryping to let access return 30 when it is empty and 50 when it isn't, but for some reasons it all turns out to be 50. Am I missing sth?

Many thanks.
=IIf(IsNull([City]),"30","50")

Open in new window

0
Comment
Question by:Touy
5 Comments
 
LVL 11

Accepted Solution

by:
Quetzal earned 32 total points
ID: 24073363
Try =Iif(Nz([City],"")="","30","50")
0
 
LVL 41

Assisted Solution

by:ralmada
ralmada earned 31 total points
ID: 24073409
That can only mean that City is not null. it could be a space. Try like this:
=IIf(Trim([City])="","30","50")  
0
 
LVL 74

Assisted Solution

by:Jeffrey Coachman
Jeffrey Coachman earned 31 total points
ID: 24074454
Touy,

Are these numbers "Strings" (text), or actual Numeric values?

Try this if they are numeric:
=IIF([City]="" OR IsNull([City]),30,50)

Also, can you state what this formula is the control source of?

JeffCoachman
0
 
LVL 46

Assisted Solution

by:tbsgadi
tbsgadi earned 31 total points
ID: 24076173
Try =IIf(len(Nz([City]))<2,30,50)
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Auto Center Controls on a Form Based on Screen Size/Resolution in MS Access 10 39
SYbase 4 31
DSN-LESS connection to MS Access database 6 30
DCount Type Mismatch 2 22
In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
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…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

777 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