473,397 Members | 2,116 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

Totals from a sub-report

I had a report today with two sub reports. The main rpt was invoice and the
subs were parts and labor. I had to bring the sub-totals into the form,
etc., to create an invoice with a total price.

What a bunch of crap I had to go through to get this thing to work. The
difficulty was that some reports had parts and no labor, or vica-versa. Any
kind of anything of trying to deal with the null recordset gave me the
#stupid# error in the subtotal fields on the main report.

I ended up doing this elaborate thing where I created two text boxes, each
of which contained the dcount of the recordset of the subforms. Then in the
actual parts and labor subtotal fields I used iif statements referring back
to those hidden text boxes.

This one really got me today! There must be a simple solution to this
problem. Any suggestions?

Mike
Nov 13 '05 #1
1 1751
Test the HasData property of the report in the subreport control.
Use IIf() to supply zero if it has no data.
If it has data, use Nz() to substitute zero for Null.

Assuming a subreport control named "SubParts", and a text box name
"txtSubTotal" in the subreport, the Control Source of the box on the main
report would look like this:
=IIf([SubParts].[Report].[HasData], Nz([SubParts].[Report].[txtSubTotal],
0), 0)

Set the Format property of that text box to Currency, so Access understands
the intended data type.

--
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.

"Mike Turco" <mi*******@yahoo-no-spam-4-me.com> wrote in message
news:Z91Hd.8270$nt.3718@fed1read06...
I had a report today with two sub reports. The main rpt was invoice and the
subs were parts and labor. I had to bring the sub-totals into the form,
etc., to create an invoice with a total price.

What a bunch of crap I had to go through to get this thing to work. The
difficulty was that some reports had parts and no labor, or vica-versa.
Any kind of anything of trying to deal with the null recordset gave me the
#stupid# error in the subtotal fields on the main report.

I ended up doing this elaborate thing where I created two text boxes, each
of which contained the dcount of the recordset of the subforms. Then in
the actual parts and labor subtotal fields I used iif statements referring
back to those hidden text boxes.

This one really got me today! There must be a simple solution to this
problem. Any suggestions?

Mike

Nov 13 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Hans | last post by:
I have a very simple table: fields PupilID Unit1 Unit2 Unit3.....Unitn TotalAchieved 001 4-5-04 12-9-03 2 For the Unitxxx fields I...
2
by: deko | last post by:
I have a number of queries that pull totals from different tables. How do I sum the different total values from each query to get a grand total? I tried using a Union query like this: SELECT...
2
by: | last post by:
I have gotten the following error in trying to get totals to come out on a footer. Server Error in '/test' Application....
3
by: mark | last post by:
im keeping running totals of certain columns in a datagrid, id like to put these totals in the footer - how do i do this ? or how can i put a label into the footer ? (im displaying results using...
1
by: Rippo | last post by:
Hi I have the following FO XSL document with the following data I am trying to add sub totals for each group in a XSL document but cannnot seem to work it out! Output would be something like:-...
13
by: terrybens | last post by:
Hello, I'm using a Microsft Access 2000 Project (adp file) connected to MS SQL Server 2000 database. I have created a continous form having a detail part (results of the query) and a footer...
10
by: rdemyan via AccessMonster.com | last post by:
I have a subform that displays around 10 fields. Most of the values shown result from some complex calculations. To make it easy, I have stored the results in a temporary table and then all I...
3
by: igotyourdotnet | last post by:
I'm using a gridview and I have it formatted using sub headings. now I need to get totals for each sub heading. Is this possible? example: BMW (sub heading) 25,000 14,252 25,000 total:...
11
by: Mark12345 | last post by:
HI all I have downloaded Microsofts Order managment database. I have spent hours trying to get the thing to come up with the totals of my new orders as a sub total so I can add VAT. I have tried...
2
by: plaguna | last post by:
I’m trying to get some calculations in a Query. Four fields are from a table x, and base on those fields I need to get some combination of Totals. This is the scenario. Total A : + from table x...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.