Solved

Access Null Confusion

Posted on 2012-03-16
5
295 Views
Last Modified: 2012-03-21
Simple query using query design view.  I have with account name, account, ID

If I run the query asking if account is null it lists all of the results where there is no account number but where there is an ID

I want to say that if the account is null then make the value default to that of the ID.

I have done this thousands of times but for some reason it isnt working here.  

I have

IIF([Account] is null, [ID], [Account])

Simple but it returns no values

Thanks in advance for your help.
0
Comment
Question by:NUdovich2
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 61

Assisted Solution

by:mbizup
mbizup earned 500 total points
ID: 37730396
Try this

Nz(account,id)
0
 
LVL 61

Assisted Solution

by:mbizup
mbizup earned 500 total points
ID: 37730406
That is just an alternative syntax,  but your syntax looks good too.  Are you sure you are dealing with nulls and not empty strings?
0
 

Accepted Solution

by:
NUdovich2 earned 0 total points
ID: 37730460
Thank you both, yep I am sure I am dealing with nulls (numeric) not empty strings though I tried both.  What solved it and what made it work was removing the ID field and making the field the expression so...


EXPR1:  IIf([Parent BPID] Is Null,[bpid],[parent BPID])

Therefore, viola.
0
 
LVL 29

Expert Comment

by:IrogSinta
ID: 37730593
I just wanted to say that using the NZ function as mbizup suggested is more efficient than using the IIF function you used.  Your expression would look like this:

EXPR1:  Nz([Parent BPID], [bpid])

And it means exactly the same thing as your IIF expression.
0
 

Author Closing Comment

by:NUdovich2
ID: 37746302
It is what ultimately worked.
0

Featured Post

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

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

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

705 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