Solved

Can I Do an IF Statement In an Access Query?

Posted on 2013-10-23
3
317 Views
Last Modified: 2013-10-23
I have attached an excel spreadsheet with current and expected results
using an IF statement in a Query in Microsoft Access 2007. I cannot figure out how to do what I think is a simple If statement in Access.
The A column table in Access has numeric and "blank" values in the rows.
In another access B column I would like to fill in the blank rows with the number zero and have any non-blank row in Column A fill in automatically. Is there a simple formula to do this?
Below is the formula I am trying to put together. Currently this formula just fills in the blank rows with zeros but DOES NOT fill in the other numbers.
Any help would be greatly appreciated.
Thank you
Rick

Expr1: IIf([Total Of Ext-Price6]," ",0,IIf([Total Of Ext-Price6],>0=[Total Of Ext-Price6]))
Access-Current-Expected-Results.xls
0
Comment
Question by:ES-Components
  • 2
3 Comments
 
LVL 61

Expert Comment

by:mbizup
ID: 39594193
Try this:

Expr1: IIf([Total Of Ext-Price6] = " ",0,[Total Of Ext-Price6])
0
 
LVL 61

Accepted Solution

by:
mbizup earned 500 total points
ID: 39594206
Correction:


Expr1: IIf(Trim([Total Of Ext-Price6] & "")  = "",0, [Total Of Ext-Price6])
0
 

Author Closing Comment

by:ES-Components
ID: 39594346
bmizup
You are the best!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Thank you for that quick response. The second expression works PERFECT!!!
I would have never figured it out.

Thank you again.
Rick
0

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

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

Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
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…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

685 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