464,761 Members | 959 Online
Need help? Post your question and get tips & solutions from a community of 464,761 IT Pros & Developers. It's quick & easy.

# Sub Report Problem

 P: 13 Hi, Explain: I have a report for reciept list , it contain 3 sub report. 1st for cash and it contain sub total 1 2nd for check and contain sub total 2 3rd for Credit card and contain sub total 3 and in the main report i put : total = nz(sub total 1)+nz(sub total 2)+nz(sub total 3) Problem: it give me the right total when the list contain the 3 sub totals. But the main problem appear when the list have only cash , the sub report of cach appear only , thats logic, but the total in the main report give me "# Error" because the 2 other sub report not appear. plz can anyone give to me any solution for that. Note: Access 2003 regards Zaher Rabah May 15 '07 #1
9 Replies

 Expert Mod 10K+ P: 14,534 You have posted in the Articles section. I am moving this question to the Access forum. ADMIN May 15 '07 #2

 Expert Mod 15k+ P: 31,770 I'm not sure I can help you here, but just in case : What do you mean when you say that the other sub-reports 'don't appear'? Are they invisible perhaps? May 15 '07 #3

 P: 13 I'm not sure I can help you here, but just in case : What do you mean when you say that the other sub-reports 'don't appear'? Are they invisible perhaps? yes, they are invisible bc their is no data in them. Example: This case happen when a client come and pay only cash, so the 2 sub report are empty and invisible. May 16 '07 #4

 Expert 100+ P: 181 I am familiar with this problem. My solution is this: 1. In the main report module write a function Expand|Select|Wrap|Line Numbers Function GetSubTotal(SubFRM as String) as Currency On Error Goto Err1 GetSubTotal = Me(SubFRM)![sub total] exit function err1: GetSubTotal = 0 end function 2. At the main form, put calculated field like this: Expand|Select|Wrap|Line Numbers =GetSubTotal("SubFRM1")+GetSubTotal("SubFRM2")+GetSubTotal("SubFRM3") May 16 '07 #5

 Expert Mod 15k+ P: 31,770 yes, they are invisible bc their is no data in them. Example: This case happen when a client come and pay only cash, so the 2 sub report are empty and invisible. I'm really trying to ask 'how' they are invisible here. On which objects (if any) do you set the visible property to False? If an object (control) were simply devoid of data I can't see why the Nz() would fail to return a valid result. I'm not trying to raise your hopes, as I can't see a solution anyway (if all you've said so far is true), but I think if it's clearer what you're talking about you may get lucky with someone else. May 16 '07 #6

 Expert 100+ P: 181 I'm really trying to ask 'how' they are invisible here. On which objects (if any) do you set the visible property to False? If an object (control) were simply devoid of data I can't see why the Nz() would fail to return a valid result. I'm not trying to raise your hopes, as I can't see a solution anyway (if all you've said so far is true), but I think if it's clearer what you're talking about you may get lucky with someone else. The subreport is invisible because it has no data (even report's footer and header are invisible) - that's just the way it works. And there is no way to address any objects on that invisible subreport - as it does not exist at all. So you cannot just use NZ because any reference to empty subreport will produce an error. As for the solution - see my post above :) May 16 '07 #7

 Expert Mod 15k+ P: 31,770 Nice one Dima :) I didn't realise it worked that way (I don't use sub-reports much as you can probably guess). Thanks for getting my back on this one. May 16 '07 #8

 Expert 100+ P: 181 Nice one Dima :) I didn't realise it worked that way (I don't use sub-reports much as you can probably guess). Thanks for getting my back on this one. Any time :) May 16 '07 #9

 P: 13 I am familiar with this problem. My solution is this: 1. In the main report module write a function Expand|Select|Wrap|Line Numbers Function GetSubTotal(SubFRM as String) as Currency On Error Goto Err1 GetSubTotal = Me(SubFRM)![sub total] exit function err1: GetSubTotal = 0 end function 2. At the main form, put calculated field like this: Expand|Select|Wrap|Line Numbers =GetSubTotal("SubFRM1")+GetSubTotal("SubFRM2")+GetSubTotal("SubFRM3") Hi, Dima Thank u for your help. Regards Zaher Rabah May 17 '07 #10