Solved

Can I Do an IF Statement In an Access Query?

Posted on 2013-10-23
3
314 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

743 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

11 Experts available now in Live!

Get 1:1 Help Now