Computing.Net > Forums > Database > Percentages on Access Report

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Percentages on Access Report

Reply to Message Icon

Name: AndrewD
Date: August 10, 2006 at 09:06:03 Pacific
OS: XP Pro SP2
CPU/Ram: P4 2Ghz /768MB
Comment:

Hi,

I am using Access 2002 to create a report. I have the following fields:

Field 1: shows the cost of the item

Field 2: displays the price paid.

Field 3: Displays as a percentage the price paid in relation to the cost of the item.

This all works fine unless the cost of the item is zero and the price paid is zero. When this is the case "#Num!" is displayed.

If the cost is zero and the price paid is greater then zero then "#Div/0!" is shown.

Rather than display these errors I would like it to simply display zero.

Can this be done using an iif statement? If so could someone give me some pointers on how I would need to structure it? I have tried structuring it along the lines of iif([price_paid]/[item_cost] not between 0.01 and 1000,0,[price_paid]/[item_cost])

This doesnt work. I guess I need to say that if the result is not a number then display zero otherwise .....


Can anyone help me out?

Thanks

Andrew



Sponsored Link
Ads by Google

Response Number 1
Name: Jennifer SUMN
Date: August 10, 2006 at 19:53:59 Pacific
Reply:

If statements are IF something is Then do, this...Else...do something else.


So, your If statement should read similar to (forgive the context, as I don't have VB or Office on this machine), If calculation is zero, then show zero, else, show the percentage.

Life is more painless for those who are brainless.


0

Response Number 2
Name: wizard-fred
Date: August 11, 2006 at 20:55:49 Pacific
Reply:

In general you have to detect the cause of the offending error first. If divisor is zero then message else do calculation. Doing the calculation causes the error.


0

Response Number 3
Name: AndrewD
Date: August 14, 2006 at 01:14:05 Pacific
Reply:

Thanks for the responses. Did what Wizard-fred suggested and it worked! Why didnt I think of that in the first place!


0

Response Number 4
Name: cupidc
Date: August 15, 2006 at 07:23:46 Pacific
Reply:

http://www.cisco-cert.com/Windows_XP_General/621056-Uninstalled-video-adapter-driver


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Database Forum Home


Sponsored links

Ads by Google


Results for: Percentages on Access Report

Access report www.computing.net/answers/dbase/access-report/361.html

Access reports margins problem www.computing.net/answers/dbase/access-reports-margins-problem/434.html

MS-Access query/report www.computing.net/answers/dbase/msaccess-queryreport/707.html