Solved

Access 2013 IIF statement.

Posted on 2014-01-29
4
1,186 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 500 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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
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…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

733 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