A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Setting Up & Running Reports
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

#ERROR Issues division



 
 
Thread Tools Display Modes
  #1  
Old August 18th, 2004, 03:57 PM
Jay
external usenet poster
 
Posts: n/a
Default #ERROR Issues division

I have this report on which I do a division between an embedded sub-form and
a control on the main report. When the report is run most of the controls
will have values. However, there a few that contain the dreaded "#ERROR"
message. Sample of the formula below:

=(nz([Embed_rpt_Sum_Rejected_Qty].[Report]![txt_numRejectedQty]/[txtGross1],0))

Is there a method to eliminate this error if there is no data to divide by
or into (from either control)? If there is a method to accomplish this
desired result, how?

Thanks,....

  #2  
Old August 18th, 2004, 05:18 PM
Allen Browne
external usenet poster
 
Posts: n/a
Default

To avoid the error, you need to avoid these situations:
- the subreport has no records (since referring to non-existent text box
gives an error);
- txtGross1 is zero (since division by zero causes error);

Try:

=IIf((([Embed_rpt_Sum_Rejected_Qty].[Report].HasData = False) OR
([txtGross1]=0)), 0,
Nz([Embed_rpt_Sum_Rejected_Qty].[Report]![txt_numRejectedQty] / [txtGross1],
0))

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Jay" wrote in message
...
I have this report on which I do a division between an embedded sub-form
and
a control on the main report. When the report is run most of the controls
will have values. However, there a few that contain the dreaded "#ERROR"
message. Sample of the formula below:

=(nz([Embed_rpt_Sum_Rejected_Qty].[Report]![txt_numRejectedQty]/[txtGross1],0))

Is there a method to eliminate this error if there is no data to divide by
or into (from either control)? If there is a method to accomplish this
desired result, how?



  #3  
Old August 18th, 2004, 06:37 PM
Jay
external usenet poster
 
Posts: n/a
Default

Allen:

Oooops, I'm sorry, the formula should be like so, first test the txtGross1
for null or 0, then do the same for the embedded report's control:
=[txtGross1]/IIF(([Embed_rpt_Sum_Rejected_Qty].[Report].[HasData]=False),0,(nz([Embed_rpt_Sum_Rejected_Qty].[Report]![txt_numRejectedQty]),0)))

I've got something wrong, can you take a look at this formula and let me
know the correct structure?

Thanks




"Allen Browne" wrote:

To avoid the error, you need to avoid these situations:
- the subreport has no records (since referring to non-existent text box
gives an error);
- txtGross1 is zero (since division by zero causes error);

Try:

=IIf((([Embed_rpt_Sum_Rejected_Qty].[Report].HasData = False) OR
([txtGross1]=0)), 0,
Nz([Embed_rpt_Sum_Rejected_Qty].[Report]![txt_numRejectedQty] / [txtGross1],
0))

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Jay" wrote in message
...
I have this report on which I do a division between an embedded sub-form
and
a control on the main report. When the report is run most of the controls
will have values. However, there a few that contain the dreaded "#ERROR"
message. Sample of the formula below:

=(nz([Embed_rpt_Sum_Rejected_Qty].[Report]![txt_numRejectedQty]/[txtGross1],0))

Is there a method to eliminate this error if there is no data to divide by
or into (from either control)? If there is a method to accomplish this
desired result, how?




  #4  
Old August 19th, 2004, 02:51 AM
Allen Browne
external usenet poster
 
Posts: n/a
Default

Hi Jay

Will let you work through this so you benefit.

IIf() contains 3 parts:
- something to test (resolves to True or False);
- the answer to return if it's True;
- the answer if it's False.
In these case, you need to test for 2 things, so you will end up with:
=IIf((part a) OR (part b), 0, the full expression here)

Part a is to test whether the subreport has data.
Part b is to test whether the divisor is zero.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Jay" wrote in message
...
Allen:

Oooops, I'm sorry, the formula should be like so, first test the txtGross1
for null or 0, then do the same for the embedded report's control:
=[txtGross1]/IIF(([Embed_rpt_Sum_Rejected_Qty].[Report].[HasData]=False),0,(nz([Embed_rpt_Sum_Rejected_Qty].[Report]![txt_numRejectedQty]),0)))

I've got something wrong, can you take a look at this formula and let me
know the correct structure?

Thanks




"Allen Browne" wrote:

To avoid the error, you need to avoid these situations:
- the subreport has no records (since referring to non-existent text box
gives an error);
- txtGross1 is zero (since division by zero causes error);

Try:

=IIf((([Embed_rpt_Sum_Rejected_Qty].[Report].HasData = False) OR
([txtGross1]=0)), 0,
Nz([Embed_rpt_Sum_Rejected_Qty].[Report]![txt_numRejectedQty] /
[txtGross1],
0))


"Jay" wrote in message
...
I have this report on which I do a division between an embedded sub-form
and
a control on the main report. When the report is run most of the
controls
will have values. However, there a few that contain the dreaded
"#ERROR"
message. Sample of the formula below:

=(nz([Embed_rpt_Sum_Rejected_Qty].[Report]![txt_numRejectedQty]/[txtGross1],0))

Is there a method to eliminate this error if there is no data to divide
by
or into (from either control)? If there is a method to accomplish this
desired result, how?



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with Division Cells Denise Posey Worksheet Functions 0 December 7th, 2003 07:18 PM
Excel no longer allows new formulas containing the division "/" operator SA Setting up and Configuration 1 November 1st, 2003 08:20 AM
Division operator no longer works Doug Talbott Worksheet Functions 1 October 1st, 2003 05:20 PM


All times are GMT +1. The time now is 07:51 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.