Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Printing Reports with #Num comment as Null

Status
Not open for further replies.

Bicester

IS-IT--Management
May 24, 2005
6
GB
I'm new to Tek Tips and Access but I have designed a database that adds, divides and produces percentages on a report. This works OK but as we all know, it is not very good at divide by zero. This is ok by me as any sum that has to do this comes out as a #Num! comment on the form.

Is there anyway I can, on printing this form substitute #Num! for space. ie swapping the visual #Num! for a space.

I know about the IIF and Nz expression and tried this in the arithmatic but I find it easier to live with the error output if I could blank it.
 
I would use the correct expressions/calculations as required by your data. I would also not print a form.

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Thanks for the reply dhookom. I meant to put report and not form. It is a report I am printing and there is a lot of maths behind it. It took me a long while to be able to get it to do the divisions and percentages so that the answers came out right. It is just that if there is a 0 or null space put in by the operator then the answer comes out #Num!. I have no problem with this it's just I would like to substitute a "0" or blank space on the printed report rather than "#Num!".

I have tried to put in the expressions as detailed in Access help but the whole report either came out blank or just seemed to hang.

As I said I am fairly new to Access so any help would be welcome.

Thanks
 
I would use functions like IIf() or Nz() or other to avoid the #Num! error.

You haven't provided any sample data or calculation expressions so it is difficult to be more explicit.

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
A B C D TOTAL Percentage

100 50 75 100 B+C+D Total as a percentage of A
This is one of the calculations required. If column A or Total is 0 or null then the Percentage column is #Num! This is what I would like to show a blank of 0 on the print out of the report. This a simple version of what I'm trying to do as my report has to do Percentages of Various totals and sections. Hope this helps?
 
Would you share the current control source for your Percentage column?

Could you try something like:

=IIf((Nz(,0) + Nz([C],0) + Nz([D],0))= 0, 0, Nz([A],0)/(Nz(,0) + Nz([C],0) + Nz([D],0)))

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top