473,657 Members | 2,832 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Retrieve fields on report from two subreports

294 Contributor
I am trying to pull the SUM() from 2 subreports. It works for one subreport, however not for the other.

What I tried: I Sum() the field in the subreports, so I can refer to that field on the main report. However, for the test case I am trying, there are no records for one of the subreports, so I tried:

Expand|Select|Wrap|Line Numbers
  1. =IIf([PayoutByYrLTTSbRpt].[Report].[NoRecords],0,[PayoutByYrLTTSbRpt].[Report].[LTtotal])
Expand|Select|Wrap|Line Numbers
  1. =IIf([PayoutByYrLTTSbRpt].[Report].[NoData],0,[PayoutByYrLTTSbRpt].[Report].[LTtotal])

And I also tried :

Expand|Select|Wrap|Line Numbers
  1. =IIf([PayoutByYrLTTSbRpt].[Report].[HasData], [PayoutByYrLTTSbRpt].[Report].[LTtotal],0)
Both give me the `#Name?` error when ran. I've tested `=[PayoutByYrLTTSb Rpt].[Report].[PytGross]` and it doesn't throw an error in design view, but when ran it does. That tells me it is an issue at run time because the report was able to find the fields I am referring to in design view (thus naming is correct).

For the subreport that is giving me trouble, I have :

Expand|Select|Wrap|Line Numbers
  1. Option Compare Database
  2.  
  3.     Private Sub Report_NoData(Cancel As Integer)
  4.     Cancel = True
  5.     End Sub
  6.  
><
May 1 '14 #1
3 1324
zmbd
5,501 Recognized Expert Moderator Expert
because the report was able to find the fields I am referring to in design view (thus naming is correct) (...) and it doesn't throw an error in design view (...)
#Name? Errors only show at run time in the report. Therefor, your logic does not hold to be true.

Both give me the `#Name?` error when ran. I've tested `=[PayoutByYrLTTSb Rpt].[Report].[PytGross]
This indicates that the field/control you are refering to does not exsist and this usually do to either a typo or incorrect referenceing.
Now because I'm not exactly sure of where the [PytGross] is located on your form, it's hard to determine what reference you need to make.
For example if you have a OutsideForm, InsideLeft, InsideRight
and for the InsideLeft![textbox1] and for the InsideRight[Textbox2] and InsideRight[Textbox3]
If you wanted the sum of Textbox2 and Textbox3 so show in Textbox1 then in the InsideLeft![textbox1] - in the control source you would need:
Expand|Select|Wrap|Line Numbers
  1. =CLng([Forms]![Outside]![InsideRight]![text2])+CLng([Forms]![Outside]![InsideRight]![text3])
For formatting purposes (I don't want a block of white space where that subreport should have been, this is necessary for each subreport).
One question per thread please
May 1 '14 #2
mcupito
294 Contributor
I'm sorry you interpreted my last sentence as another question - I was stating that the code segment
Expand|Select|Wrap|Line Numbers
  1. Cancel = True
, had it been related to my problem, is necessary.

As far as the meat of your response - The two subreports are set up the exact same way. The field I am summing (PytGross) is a field in the detail section of each subreport. I'm not sure what you mean by InsideLeft InsideRight. PytGross is not a field on a form, but rather a field in the query and on the report.

That being said, I am referencing both fields on each subreport the exact same way, which is why I thought it might have been related to the Cancel = True bit of code on the report where I am not getting any data.

I don't understand why
Expand|Select|Wrap|Line Numbers
  1. =[PayoutByYrLTRSbRpt].[Report].[LRtotal]
works, but
Expand|Select|Wrap|Line Numbers
  1. =[PayoutByYrLTTSbRpt].[Report].[LTtotal]
doesn't.

LTtotal is the field that isn't working, specifically, when being called. It is a textbox with this bit of code in it
Expand|Select|Wrap|Line Numbers
  1. =Sum([PytGross])
as the control source.
[PytGross] is a textbox with name PytGross_txt and Control Source PytGross.

Should I be referencing PytGross_txt or PytGross in the bit of
Expand|Select|Wrap|Line Numbers
  1. =Sum([PytGross])
? Maybe that's where the error lies.
May 1 '14 #3
zmbd
5,501 Recognized Expert Moderator Expert
For example if you have a OutsideForm, InsideLeft, InsideRight
and for the InsideLeft![textbox1] and for the InsideRight[Textbox2] and InsideRight[Textbox3]
If you wanted the sum of Textbox2 and Textbox3 so show in Textbox1 then in the InsideLeft![textbox1] - in the control source you would need:
Three forms
Outside
then subform on the left of hte parent outside form
another subform on the rightside of the parent outside form
...
May 1 '14 #4

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

Similar topics

0
1215
by: Raj | last post by:
I am working on a ASP.NET 1.0 project in VS.NET 2003 and have added a crystal report 9.2 report to it. After building solution when I load the page with this report, it gives me error Compiler Error Message: BC30002: Type 'Report1' is not defined. Report1.vb is the class object which gets created when the Report1.rpt is added to the project. I have verified with ildasm utility that it sits in
6
2028
by: Richard Holliingsworth | last post by:
Hello: Thanks for reading this. I would like to build a report (Access 2002) that uses SQL queries to count records in specific groups. I've tried several methods and so far no luck. Could someone please point me in the right direction on this one. It
3
7455
by: manning_news | last post by:
Using A2K. I've been asked to modify a report currently requiring only one date parameter to now accept a date range. The main report has 2 subreports and is not bound to a table or query. The report prints dental and hygenist appointments for the date (one subreport for each). The user wants to enter a date range and have one page for each date in the date range. I'm wondering how to modify the report. The only way I see is to create...
0
2386
by: KartoffelKiffer | last post by:
Hello, i have to do a little Crystal Report task, where i need help. I have a mainreport in which are some subreports. The size of the subreports can vary so the subreport which could be bigger than before overlap the other subreports. Is it psossible that the subreports are fixed an when they need more place the size could be bigger ? I hope my english is ok, so you can help me :?
0
1297
by: khairihusseini | last post by:
I have following code: Private Sub SetDataBaseLocation(ByVal Report As ReportDocument) For Each oConnectionInfo As .IConnectionInfo In Report.DataSourceConnections oConnectionInfo.SetConnection(_Servername, _DatabaseName, _Username, _Password) oConnectionInfo.SetLogon(_Username, _Password) Next
1
5156
by: Brad | last post by:
Thanks for taking the time to read my question. I have a table of data that has Date, Data and Category. I need to show, in a report, each Categories Data by Date. The Date has to be it's own column across the top and Category down the left side. As data is entered, the number of unique dates increases. As a result the
13
2193
by: no.mail.pls | last post by:
Hiya, How do i retreive fields with similar values from 2 tables? I tried to use (1) "SELECT * FROM $table1 as o , $table2 as p WHERE o.name like '%p.name%'"; but it retrieves nothing at all. (2) "SELECT * FROM $table1 as o , $table2 as p WHERE o.name like p.name";
2
2263
by: kfboren | last post by:
I am wondering if someone can help me. I have created 10 tables, 10 queries for the tables and 10 reports from the quearies. The creteria for the queries is the field named "month". I have created one main report, which includes all 10 of the subreports. When opening the main report I have to enter the creteria month which is the same for all 10 queries. How can I open this main report and only enter the creteria one time which would satisfy all...
6
5443
by: Brett Barry: Go Get Geek! | last post by:
Hello, I have a main report with a Record Source, a DateToday table, that has the current Month and Year. I have about 60 queries, each pulling different data via ODBC, that I am creating subreports that go on the main report. The problem is that when I run the report the data shows on the screen but not the print preview. I am aware that the main report is not linked to the subreports because of the Link Master, Child Fields issue....
2
2181
by: hmznzr | last post by:
i am using b.net 2005. i am generating a crystal report. but when i work in a different computer i have to set the location of the database of the report before i generate. is their any dynamic way to set my database location to the report.
0
8303
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8723
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8502
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8602
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7316
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5632
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4300
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2726
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1601
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.