473,383 Members | 1,952 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,383 software developers and data experts.

Problem Totalling Subreport on Main form

43
Hi All,

I know you have heard this all before from the millions of other people asking the same question, but I have read through many other posts and NeoPa's guide and another guide i found on the internet (http://allenbrowne.com/casu-18.html) but to no avail.

Some background info:

frmTours
Contains 2 subforms (on seperate tabs), one to select the desire Tour Days and the other to select the Additional Costs.

rptInvoice
This contains two subreports in the ClientID header section (tblToursOffered subreport and tblAdditionalCosts subreport). Both of these subreports have a subtotal textbox in the Report Footer section (=Sum([DayPrice]) and =Sum([Price])). They are named 'Subtotal1' and 'Subtotal2' and show the subtotal without problem.

The problem occurs when I try to create a textbox displaying the total in the main form. I get either #Name or a #Error appearing in the box when i run the report. I have tried lots of different control sources for this text box and have placed it in all different sections of rptInvoice (ClientID Header, Detail, ClientID Footer and Page Footer). The code I have tried is as follows (I only tried to display Subtotal1 to start with but would like it to total both):

Expand|Select|Wrap|Line Numbers
  1. =IIf([tblToursOffered subreport].[Report].[HasData],Nz([tblToursOffered subreport].[Report].[Subtotal1],0),0)
But get the #Error when I run the report.

I have tried to explain this as best I can but any information you need, let me know.

Many thanks in advance for any help you can offer.

Edd
Apr 14 '07 #1
6 2912
ADezii
8,834 Expert 8TB
Hi All,

I know you have heard this all before from the millions of other people asking the same question, but I have read through many other posts and NeoPa's guide and another guide i found on the internet (http://allenbrowne.com/casu-18.html) but to no avail.

Some background info:

frmTours
Contains 2 subforms (on seperate tabs), one to select the desire Tour Days and the other to select the Additional Costs.

rptInvoice
This contains two subreports in the ClientID header section (tblToursOffered subreport and tblAdditionalCosts subreport). Both of these subreports have a subtotal textbox in the Report Footer section (=Sum([DayPrice]) and =Sum([Price])). They are named 'Subtotal1' and 'Subtotal2' and show the subtotal without problem.

The problem occurs when I try to create a textbox displaying the total in the main form. I get either #Name or a #Error appearing in the box when i run the report. I have tried lots of different control sources for this text box and have placed it in all different sections of rptInvoice (ClientID Header, Detail, ClientID Footer and Page Footer). The code I have tried is as follows (I only tried to display Subtotal1 to start with but would like it to total both):

Expand|Select|Wrap|Line Numbers
  1. =IIf([tblToursOffered subreport].[Report].[HasData],Nz([tblToursOffered subreport].[Report].[Subtotal1],0),0)
But get the #Error when I run the report.

I have tried to explain this as best I can but any information you need, let me know.

Many thanks in advance for any help you can offer.

Edd
Your Syntax may be slightly off. Your Text Box is on the Main Form, so you may have to more fully qualify the path:
Expand|Select|Wrap|Line Numbers
  1. Me![tblToursOffered subreport].Report.HasData
  2.                                   OR
  3. Reports!<your report name>![tblToursOffered subreport].Report.HasData
Apr 14 '07 #2
xian2
43
Hi,

many thanks for your response.

I tried:

Reports!rptInvoice![tblToursOffered subreport].Report.HasData

But got the value '-1' and was wondering how i complete the expression to get it to equal the value in textbox 'Subtotal1'

Also, how would I get it to total the amount in both subforms?

Subtotal1 + Subtotal2?

many thanks again

Edd
Apr 14 '07 #3
xian2
43
Ah, Got it thanks to a friend.

Simple error, the boxes were named Text12 and Text14 not Subtotal1 and Subtotal2. I thought I had renamed them

Here is the finished code for them:

Expand|Select|Wrap|Line Numbers
  1. =[Reports]![rptInvoice]![tblToursOffered subreport].[Report].[Text12]
Expand|Select|Wrap|Line Numbers
  1. =[Reports]![rptInvoice]![tblAdditionalCosts subreport].[Report].[Text14]
The only problem now is trying to add the two expressions. Any Ideas?

I have tried the Sum function but probably did it wrong.

Any ideas greatly appreciated as always.

Best

Edd
Apr 14 '07 #4
ADezii
8,834 Expert 8TB
Hi,

many thanks for your response.

I tried:

Reports!rptInvoice![tblToursOffered subreport].Report.HasData

But got the value '-1' and was wondering how i complete the expression to get it to equal the value in textbox 'Subtotal1'

Also, how would I get it to total the amount in both subforms?

Subtotal1 + Subtotal2?

many thanks again

Edd
-1 equates to True and indicates that the Sub-Report in fact does have data. To obtain the value in Subtotal1 Text Box:
Expand|Select|Wrap|Line Numbers
  1. Reports!rptInvoice![tblToursOffered subreport].Report![Subtotal1]
Use similiar syntax for the other Sub-Report, as in
Expand|Select|Wrap|Line Numbers
  1. Reports!rptInvoice![<sub report name>].Report![Subtotal2]
Apr 14 '07 #5
NeoPa
32,556 Expert Mod 16PB
...The only problem now is trying to add the two expressions. Any Ideas?

I have tried the Sum function but probably did it wrong.

Any ideas greatly appreciated as always.

Best

Edd
Unless I misunderstand something here, you just need to use the '+' operator.
You have A & B so you're looking for :
Expand|Select|Wrap|Line Numbers
  1. =A+B
Expand|Select|Wrap|Line Numbers
  1. =[Reports]![rptInvoice]![tblToursOffered subreport].[Report].[Text12]+[Reports]![rptInvoice]![tblAdditionalCosts subreport].[Report].[Text14]
Apr 18 '07 #6
xian2
43
Great, worked an absolute treat,

Thank you

Edd
Apr 18 '07 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: David B | last post by:
I have a report with 2 sub reports on it. The report is an invoice and the sub reports are dropping data onto the invoice. This worked fine if generating 1 invoice at a time. I am trying to create...
1
by: Kirsty Ryder | last post by:
Hi, I have a Report with a subreport, and I want to assign a value to the control source of a control on the subreport depending on the value given by the user in a separate form. Based on...
1
by: shaqattack1992-newsgroups | last post by:
I know this is kind of a weird question, but is there anyway to give a subreport control of a main report? I posted my situation earlier about having drawings print out after a group. I have a...
8
by: | last post by:
hi, i have a form on which a user can choose specific criteria such as dates etc, in order to filter the report that is called from the form. i do this by using the Where section of the...
4
by: MLH | last post by:
I have a report and on it, a subreport control Main Report Name: rptInvoiceMain Sub Report Name: rptInvoiceSubReport SubReport Control Name: rptInvoiceSubReportCtl The...
2
by: Henrootje | last post by:
I have a report concerning a customer. In this report we find four subreports. They are in layout identical but data comes from different tabel. Now on the main report I count the totals of each...
11
by: Simon | last post by:
Dear reader, The syntax for the VBA code to change the RowSource of a Master Report is: Me.RowSource = "TableOrQueryName"
0
by: EManning | last post by:
Using 2003. I've got a main report with a subreport and within that subreport is another subreport, all bound. The detail in the 2nd subreport is repeated multiple times for some reason. The...
3
by: Simon van Beek | last post by:
Dear reader, How to change the RecordSource for a subReport. For forms the syntaxes is:
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.