Solved

Format and expression string on report

Posted on 2007-11-19
3
666 Views
Last Modified: 2013-11-28
I have a report in which I put a text box that returns the average.  (Done for me)  However I forgot to make sure that it rounds up.  I tried to format it but cant seem to get it correct.  here is the expression
=sum(IIF([expr4]<>0,[expr4],0))/sum(IIF([expr4]<>0,1,0))  Need to round to next # if it has decimals

Thanks
0
Comment
Question by:kdeutsch
  • 2
3 Comments
 
LVL 65

Expert Comment

by:rockiroads
ID: 20314421
u could try round around everything

=ROUND(sum(IIF([expr4]<>0,[expr4],0))/sum(IIF([expr4]<>0,1,0)),0)

0
 
LVL 59

Expert Comment

by:Chris Bottomley
ID: 20314454
Dont think there is a round up as such in access however you can fiddle it in VBA i.e.

dim dbl x as double
dim intx as integer
dblx = sum(IIF([expr4]<>0,[expr4],0))/sum(IIF([expr4]<>0,1,0))
intx = round(dblx ) + iif(round(dblx )< dblx ,1, 0)

Chris
0
 
LVL 65

Accepted Solution

by:
rockiroads earned 125 total points
ID: 20314599
Timely reminder from Chris :)

I forgot the 0.5 in my rounding, ha

=ROUND(sum(IIF([expr4]<>0,[expr4],0))/sum(IIF([expr4]<>0,1,0))+0.5,0)
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

778 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