Solved

Access 2013 IIF statement.

Posted on 2014-01-29
4
1,123 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
  • 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 119

Accepted Solution

by:
Rey Obrero 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Lync meeting or Lync conferencing is what many organizations would like to deploy to allow them save money. But companies are now giving up for various reasons, one of which is that they cannot join external meetings (non-federated company meetings)…
The System Center Operations Manager 2012, known as SCOM, is a part of the Microsoft system center product that provides the user with infrastructure monitoring and application performance monitoring. SCOM monitors:   Windows or UNIX/LinuxNetwo…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

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

12 Experts available now in Live!

Get 1:1 Help Now