Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Access 2013 IIF statement.

Posted on 2014-01-29
4
Medium Priority
?
1,266 Views
Last Modified: 2014-01-29
I am converting an Excel 2013 spreadsheet to an Access 2013 database.  I am trying to convert an if statement to an IIF statement in a calculated field.

My IIF statement
IIf([R1_CircOrder]="0"," ",(([R1_GrossCopies]-[R1_CircOrder])/[R1_CircOrder]))

when I try to save this I get an error that says.

"The expression could not be saved because it result type, such as binary or NULL, is not supported by the server.

Can someone tell me what I'm doing wrong.

Marshall
0
Comment
Question by:Mwvarner
[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
4 Comments
 
LVL 10

Expert Comment

by:Gozreh
ID: 39818591
Change it to
IIf(IsNull([R1_CircOrder]),0,(IIf(IsNull([R1_GrossCopies]),0,[R1_GrossCopies])-IIf(IsNull([R1_CircOrder]),0,[R1_CircOrder]))/IIf(IsNull([R1_CircOrder]),0,[R1_CircOrder]))

Open in new window


and the ResultType should be "Double"
0
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 2000 total points
ID: 39818597
try this

IIf([R1_CircOrder]=0,"",(([R1_GrossCopies]-[R1_CircOrder])/[R1_CircOrder]))

or
IIf([R1_CircOrder]=0,0,(([R1_GrossCopies]-[R1_CircOrder])/[R1_CircOrder]))

or
IIf([R1_CircOrder]=0,NULL,(([R1_GrossCopies]-[R1_CircOrder])/[R1_CircOrder]))
0
 
LVL 10

Expert Comment

by:Gozreh
ID: 39818629
The first one will not work, only the other 2.

but if R1_CircOrder or R1_GrossCopies will be null, the calculated result will be Null, so best solution will be always in calculated fields to use IIF(IsNull(Field),0,Field)
like this IIf(IsNull([R1_GrossCopies]),0,[R1_GrossCopies])
0
 

Author Closing Comment

by:Mwvarner
ID: 39818864
The first one didn't work but the other two options did work for me.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

618 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