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

Calculated control in a report

418 256MB
Hi:

I have a report that's based on a query. This report has two sub reports which are also based on two separate queries.

Main report: rptECHO
Sub reports: srptEchoAP & srptEchoPay

srptEchoAP has all data pertaining to invoice payments for all ECHOs. (ECHO is a process through which expenses for a grant get reimbursed.) Similarly, srptEchoPay has data pertaining to payroll expenses.

I have sub total of AP and sub total of Payroll expenses on the respective sub reports. I need to show the Total ECHO expenses (AP + Payroll) at the bottom of the rptECHO.

How do I do it? Any help is much appreciated.

Thanks.
May 28 '09 #1

✓ answered by NeoPa

Before I get a chance to look at this properly, you may want to take a look through Referring to Items on a Sub-Form. If you remember that most references to subforms should work very similarly for subreports, you should be able to work out the referencing.

If not then I'll try to take a proper look later to see if I can get it to work.

19 2341
NeoPa
32,556 Expert Mod 16PB
What are the names of the controls on your subreports?

What are the names of your subreport controls on the main report (You've already supplied the names of the reports themselves, contained within. This is not the question)?
May 28 '09 #2
MNNovice
418 256MB
Sub Report: srptEchoPayDetail
Control Name: txtPayAmount

Sub Report: srptEchoAPDetail
Control Name: txtAPNet

I need the total on rptECHO (main report)
txtAPNet + txtPayAmount

I tried this on the report footer. Didn't work. Perhaps somehow I need to refer to these text boxes to the sub report. This I don't know how to do.

Thanks.
May 28 '09 #3
NeoPa
32,556 Expert Mod 16PB
Before I get a chance to look at this properly, you may want to take a look through Referring to Items on a Sub-Form. If you remember that most references to subforms should work very similarly for subreports, you should be able to work out the referencing.

If not then I'll try to take a proper look later to see if I can get it to work.
May 28 '09 #4
NeoPa
32,556 Expert Mod 16PB
I've just checked over your answer in more detail & I notice you haven't answered my questions. I expect you haven't understood clearly, but please read again carefully and provide the requested information.
May 28 '09 #5
MNNovice
418 256MB
What are the names of the controls on your subreports?
Sub Report: srptEchoPayDetail
Control Name: txtPayAmount (Text67 on the version of DB you have)

Sub Report: srptEchoAPDetail
Control Name: txtAPNet (Text71 on the version of DB you have)


What are the names of your subreport controls on the main report (You've already supplied the names of the reports themselves, contained within. This is not the question)?
I don't have created a control (to calculate the total) for the subreport on the main report - yet (hope I understood your question).

If not, let me know.
May 28 '09 #6
MNNovice
418 256MB
I will read it and shall let you know. Thanks.
May 28 '09 #7
MNNovice
418 256MB
NeoPa:

I found this write up on the net and it solved my problem. However I succeeded only with the STEP 1. I would like to try the NZ formula part of it, may be tomorrow.

The controls of my subform on the main form are: PayExpenes and APExpenses

Thanks and have a nice evening.


Bring the total from a subreport back onto the main report
Your subreport has a total at the end - a text box in the Report Footer section, with a Control Source like this:
Expand|Select|Wrap|Line Numbers
  1. =Sum([Amount])
Now, how do you pass that total back to the the main report?
Stage 1
If the subreport is called Sub1, and the text box is txtTotal, put the text box on your main report, and start with this Control Source:
Expand|Select|Wrap|Line Numbers
  1. =[Sub1].[Report].[txtTotal]
Stage 2
Check that it works. It should do if there are records in the subreport. If not, you get #Error. To avoid that, test the HasData property, like this:
Expand|Select|Wrap|Line Numbers
  1. =IIf([Sub1].[Report].[HasData], [Sub1].[Report].[txtTotal], 0)
Stage 3
The subreport total could be Null, so you might like to use Nz() to convert that case to zero also:
Expand|Select|Wrap|Line Numbers
  1. =IIf([Sub1].[Report].[HasData], Nz([Sub1].[Report].[txtTotal], 0), 0)
May 28 '09 #8
NeoPa
32,556 Expert Mod 16PB
@MNNovice
When putting a subreport into another (main) report, the subreport is actually defined as a report. What makes it a subreport is that a control (a subreport control) is created on the main report. This control contains a report, which is what you generally refer to as the subreport. Technically however, this is not the subreport. The subreport is the control that contains the embedded report. The names of these (subform) controls are what I'm after.
May 28 '09 #9
NeoPa
32,556 Expert Mod 16PB
@MNNovice
This is fundamentally what I was trying to get at (if you check the link I provided in post #4). Notice the code refers to the subreport control ([Sub1]).

What you need to do with this process is firstly to work out the names of all the elements you want to deal with. This I was trying to help with, with my request for names etc.
May 28 '09 #10
NeoPa
32,556 Expert Mod 16PB
I need to ask why [Text67] is in ECHOID Footer, instead of the Report Footer? Do you want only the last ECHOID value?

PS. One of your subreport controls is called [A/P Expenses] if that helps.
May 28 '09 #11
NeoPa
32,556 Expert Mod 16PB
It seems the other is called [rptEchoPaySum]. I may have run out of time for tonight though. I'll look again when I can.
May 29 '09 #12
MNNovice
418 256MB
NeoPa:

I got this issue resolved. Don't spend any of your time on this matter. Thanks.
May 29 '09 #13
MNNovice
418 256MB
I have updated the DB since the last copy that was posted. I learned about the control of a sub report once I read the article I posted on Posting #8.

"A/P Expenses" was rejected by ACCESS so I changed it to "APExpenses"
May 29 '09 #14
NeoPa
32,556 Expert Mod 16PB
Thanks for updating M.

As for the names of your controls, I recommend finding some form of consistent naming convention so that you can always understand from the name what the item is about. Also, that you can know what the name should be simply by knowing what the control is for.

Does that make sense?
May 29 '09 #15
MNNovice
418 256MB
NeoPa:

Thanks for the tips. I usually try to follow the naming convention to the best of my ability. My tables are tblXXXX, query/ qryXXXX, report / rptXXXX Forms, frm, Subforms/sfrm....and for controls I use cmd (Command box), txt (text box). Majority of the time I don't name the labels. However, for subform's control - I didn't know how to name it.

Thanks.
May 29 '09 #16
NeoPa
32,556 Expert Mod 16PB
That sounds quite sensible M :)

I would only suggest that the subform control is more important to name (as sfm or sfrm) than the form which is to be used as a subform (which is essentially just a form).

I would always recommend avoiding any and all punctuation characters in your names. Spaces included.

Otherwise you already have a very solid foundation :)
May 29 '09 #17
MNNovice
418 256MB
NeoPa:

I will remember your suggestions and will try to follow it. Thanks. M
Jun 1 '09 #18
@NeoPa
I've learned the value of spending quality time searching through old threads...........thank you for this understanding of naming controls - and that they are not necessarily equivalent to the name of your subreports. Oh how I love when the light bulb pops on! Many thanks! :)
May 4 '10 #19
NeoPa
32,556 Expert Mod 16PB
I'm pleased you found it helpful, and thanks for posting your comments. It never hurts to hear things like that :)
May 5 '10 #20

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

Similar topics

0
by: Pat S | last post by:
I have a report in which each record is about work booked to be done by my company for a client. Each day of work is represented by one record. The report is grouped by CLIENT -- so each page...
2
by: Josh Nikle | last post by:
I have a subreport that displays the addresses of suppliers. Its source table has fields for the name, street, city/state, and ZIP code for easier querying. However, for display purposes, I put...
5
by: Richard Holliingsworth | last post by:
Hello: Thanks for reading this post. I need to create a metrics (form or report - I don't care which) to display calculated fields about the database (A2002 front end to SQL Server 2K) 1) I...
3
by: jdph40 | last post by:
I've been given a database and asked to figure out how to sort a report. The report needs to be sorted on a field that is the sum of a field that is calculated in the underlying query. NetSales...
2
by: Norma | last post by:
I have a table with a UPC#, CasesCompleted, TotalHours, standardGoal (pieces per hour) I am generating a report that groups by UPC and figures out production goals. In the Detail section of each...
2
by: hhathome | last post by:
In my report I have a calculated DateDiff Field, I also have a calculated count field. I'm trying to get a total of the DateDiff field and dividing it by the count field and I'm having problems --...
1
by: shobhit_shanker | last post by:
Here are the relevant "givens" to my problem... Form: frmLaunchRpt - Text Box: txtAsOfDate - Check Box: chkLogEval - Command Button: cmdLaunchRpt Report: rptEvaluation - Text Box:...
1
by: Dave | last post by:
This one's pretty basic, but I really need help. I have two tables, one with customer information and another which looks up prices depending upon size in united inches. It works fine if I...
1
by: verb13 | last post by:
I have 2 text fields in a report coming from a recordset. I want to have a third field which will contain the result of some complex string manipulation of the 2 fields. How can I achieve this? The...
3
by: kelley.l.turner | last post by:
Hi all, I am very new to MS Access so please bear with me! I have created a simple calculated field in my data entry form, yet when I view my data table or try to generate a report based on...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
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
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: 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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...
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...

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.