Need help working with sub reports and main report.

G

Guest

What I am trying to do is calculate the sum of a control on a sub report that
refeers to some fields on the main report. In the detail section of the sub
report the control calculates the values correctly and it references some
fields on my main form. Yet when I try to calculate the total for the
control in the footer section it treats my reference to the fields on my main
report as paramater values. For the life of me I can not figure out what I
am doing wrong. Can anyone help please?

Main Report Name: rptDailyProductionApples

Sub report Name: rptDailyProductionApplestblWipDistLabsubreport

Control on sub report (in detail section) to be totaled: txtUnitCostProd

Contents of [txtUnitCostProd]:
=Sum(IIf([GlCode]="61269-02",+[Reports]![rptDailyProductionApples]![txtSetUpUnitCost]+[Reports]![rptDailyProductionApples]![txtProductionUnitCost]+[Reports]![rptDailyProductionApples]![txtCleanUpUnitCost],[txtOtherExpenseUnitCost]))

I have tried entering the following with both resulting in the "paramater
value" issue.

=sum([txtUnitCostProd]) and

=sum(IIf([GlCode]="61269-02",+[Reports]![rptDailyProductionApples]![txtSetUpUnitCost]+[Reports]![rptDailyProductionApples]![txtProductionUnitCost]+[Reports]![rptDailyProductionApples]![txtCleanUpUnitCost],[txtOtherExpenseUnitCost]))

Can anyone help pelase?

Thanks,
FatMan
 
S

strive4peace

instead of

[Reports]![rptDailyProductionApples]![txtSetUpUnitCost]

try

nz(parent.txtSetUpUnitCost,0)

I also wrapped it with NZ in case it is null

don't forget to put a space on both side of your operators (
ie: + )

It is a good habit and some operators, like &, may not
function right unless they are delimited

Have an awesome day

Warm Regards,
Crystal

MVP Microsoft Access

remote programming and training
strive4peace2006 at yahoo.com
 
G

Guest

Crystal:
Thank you for your advice. Some how I manage to gt it fixed before your
reply. I deleted all the controls and fields and rewrote all my
exspressions again. Not sure exactly what I did different but it is working.

Can you please take a look at this and offer me any insight you might have
as to what is wrong. Still working with the same report and two sub-reports.
What I now need to to is add the total calculated on each sub report and
display this total on the main report.

Main Report: rptDailyProductionApples
SubReport #1: rptDailyProductionApplestblWipDistLabsubreport
SubReport #2: rptDailyProductionApplestblWipJobAllMatsubreport
Control from Subreport #1: txtLabUnitCostProdTotal
Control From Subreport #2 txtMatUnitCostProdTotal

I have used the exspression builder to create the following exspression:
=[Reports]![rptDailyProductionApplestblWipJobAllMatsubreport]![txtMatUnitCostProdTotal]
+
[Reports]![rptDailyProductionApplestblWipDistLabsubreport]![txtLabUnitCostProdTotal]

The above yields the following results: #Name?

When I include the main report's name in the above exspression (between
[Reports] and [rptDailyProductionApples...]) it yields the follwoing results:
#Error

Can you or anyone else please help me with this?

Thanks,
FatMan







strive4peace said:
instead of

[Reports]![rptDailyProductionApples]![txtSetUpUnitCost]

try

nz(parent.txtSetUpUnitCost,0)

I also wrapped it with NZ in case it is null

don't forget to put a space on both side of your operators (
ie: + )

It is a good habit and some operators, like &, may not
function right unless they are delimited

Have an awesome day

Warm Regards,
Crystal

MVP Microsoft Access

remote programming and training
strive4peace2006 at yahoo.com

What I am trying to do is calculate the sum of a control on a sub report that
refeers to some fields on the main report. In the detail section of the sub
report the control calculates the values correctly and it references some
fields on my main form. Yet when I try to calculate the total for the
control in the footer section it treats my reference to the fields on my main
report as paramater values. For the life of me I can not figure out what I
am doing wrong. Can anyone help please?

Main Report Name: rptDailyProductionApples

Sub report Name: rptDailyProductionApplestblWipDistLabsubreport

Control on sub report (in detail section) to be totaled: txtUnitCostProd

Contents of [txtUnitCostProd]:
=Sum(IIf([GlCode]="61269-02",+[Reports]![rptDailyProductionApples]![txtSetUpUnitCost]+[Reports]![rptDailyProductionApples]![txtProductionUnitCost]+[Reports]![rptDailyProductionApples]![txtCleanUpUnitCost],[txtOtherExpenseUnitCost]))

I have tried entering the following with both resulting in the "paramater
value" issue.

=sum([txtUnitCostProd]) and

=sum(IIf([GlCode]="61269-02",+[Reports]![rptDailyProductionApples]![txtSetUpUnitCost]+[Reports]![rptDailyProductionApples]![txtProductionUnitCost]+[Reports]![rptDailyProductionApples]![txtCleanUpUnitCost],[txtOtherExpenseUnitCost]))

Can anyone help pelase?

Thanks,
FatMan
 
S

strive4peace

=IIF([rptDailyProductionApplestblWipJobAllMatsubreport].report.hasdata,[rptDailyProductionApplestblWipJobAllMatsubreport].report![txtMatUnitCostProdTotal],0)
+
IIF([rptDailyProductionApplestblWipDistLabsubreport].report.hasdata,[rptDailyProductionApplestblWipDistLabsubreport].report![txtLabUnitCostProdTotal],0)

.... what long names!

Have an awesome day

Warm Regards,
Crystal

MVP Microsoft Access

remote programming and training
strive4peace2006 at yahoo.com

Crystal:
Thank you for your advice. Some how I manage to gt it fixed before your
reply. I deleted all the controls and fields and rewrote all my
exspressions again. Not sure exactly what I did different but it is working.

Can you please take a look at this and offer me any insight you might have
as to what is wrong. Still working with the same report and two sub-reports.
What I now need to to is add the total calculated on each sub report and
display this total on the main report.

Main Report: rptDailyProductionApples
SubReport #1: rptDailyProductionApplestblWipDistLabsubreport
SubReport #2: rptDailyProductionApplestblWipJobAllMatsubreport
Control from Subreport #1: txtLabUnitCostProdTotal
Control From Subreport #2 txtMatUnitCostProdTotal

I have used the exspression builder to create the following exspression:
=[Reports]![rptDailyProductionApplestblWipJobAllMatsubreport]![txtMatUnitCostProdTotal]
+
[Reports]![rptDailyProductionApplestblWipDistLabsubreport]![txtLabUnitCostProdTotal]

The above yields the following results: #Name?

When I include the main report's name in the above exspression (between
[Reports] and [rptDailyProductionApples...]) it yields the follwoing results:
#Error

Can you or anyone else please help me with this?

Thanks,
FatMan







:

instead of

[Reports]![rptDailyProductionApples]![txtSetUpUnitCost]

try

nz(parent.txtSetUpUnitCost,0)

I also wrapped it with NZ in case it is null

don't forget to put a space on both side of your operators (
ie: + )

It is a good habit and some operators, like &, may not
function right unless they are delimited

Have an awesome day

Warm Regards,
Crystal

MVP Microsoft Access

remote programming and training
strive4peace2006 at yahoo.com

What I am trying to do is calculate the sum of a control on a sub report that
refeers to some fields on the main report. In the detail section of the sub
report the control calculates the values correctly and it references some
fields on my main form. Yet when I try to calculate the total for the
control in the footer section it treats my reference to the fields on my main
report as paramater values. For the life of me I can not figure out what I
am doing wrong. Can anyone help please?

Main Report Name: rptDailyProductionApples

Sub report Name: rptDailyProductionApplestblWipDistLabsubreport

Control on sub report (in detail section) to be totaled: txtUnitCostProd

Contents of [txtUnitCostProd]:
=Sum(IIf([GlCode]="61269-02",+[Reports]![rptDailyProductionApples]![txtSetUpUnitCost]+[Reports]![rptDailyProductionApples]![txtProductionUnitCost]+[Reports]![rptDailyProductionApples]![txtCleanUpUnitCost],[txtOtherExpenseUnitCost]))

I have tried entering the following with both resulting in the "paramater
value" issue.

=sum([txtUnitCostProd]) and

=sum(IIf([GlCode]="61269-02",+[Reports]![rptDailyProductionApples]![txtSetUpUnitCost]+[Reports]![rptDailyProductionApples]![txtProductionUnitCost]+[Reports]![rptDailyProductionApples]![txtCleanUpUnitCost],[txtOtherExpenseUnitCost]))

Can anyone help pelase?

Thanks,
FatMan
 
G

Guest

Crystal:
Thanks for your help and yes I agree what long names!. However it is the
only way I can keep things straight in my small mind. Do you think it would
help if I shorten the names?

I did a copy and past on your suggestion and I am now getting the following
results:
#Name?

I have checked all the names (reports & controls) in the exspression and
could not find any that were wrong. Any ideas? I have noticed that after I
print preview the report and return back to the exspression that access has
removed the "[" and "]" from around the report name and control in the second
part of the exspression and not the first. What would cuase it to do that?

Any suggestions or help you can offer is greatly appreciated.

Thanks,
FatMan

strive4peace said:
=IIF([rptDailyProductionApplestblWipJobAllMatsubreport].report.hasdata,[rptDailyProductionApplestblWipJobAllMatsubreport].report![txtMatUnitCostProdTotal],0)
+
IIF([rptDailyProductionApplestblWipDistLabsubreport].report.hasdata,[rptDailyProductionApplestblWipDistLabsubreport].report![txtLabUnitCostProdTotal],0)

.... what long names!

Have an awesome day

Warm Regards,
Crystal

MVP Microsoft Access

remote programming and training
strive4peace2006 at yahoo.com

Crystal:
Thank you for your advice. Some how I manage to gt it fixed before your
reply. I deleted all the controls and fields and rewrote all my
exspressions again. Not sure exactly what I did different but it is working.

Can you please take a look at this and offer me any insight you might have
as to what is wrong. Still working with the same report and two sub-reports.
What I now need to to is add the total calculated on each sub report and
display this total on the main report.

Main Report: rptDailyProductionApples
SubReport #1: rptDailyProductionApplestblWipDistLabsubreport
SubReport #2: rptDailyProductionApplestblWipJobAllMatsubreport
Control from Subreport #1: txtLabUnitCostProdTotal
Control From Subreport #2 txtMatUnitCostProdTotal

I have used the exspression builder to create the following exspression:
=[Reports]![rptDailyProductionApplestblWipJobAllMatsubreport]![txtMatUnitCostProdTotal]
+
[Reports]![rptDailyProductionApplestblWipDistLabsubreport]![txtLabUnitCostProdTotal]

The above yields the following results: #Name?

When I include the main report's name in the above exspression (between
[Reports] and [rptDailyProductionApples...]) it yields the follwoing results:
#Error

Can you or anyone else please help me with this?

Thanks,
FatMan







:

instead of

[Reports]![rptDailyProductionApples]![txtSetUpUnitCost]

try

nz(parent.txtSetUpUnitCost,0)

I also wrapped it with NZ in case it is null

don't forget to put a space on both side of your operators (
ie: + )

It is a good habit and some operators, like &, may not
function right unless they are delimited

Have an awesome day

Warm Regards,
Crystal

MVP Microsoft Access

remote programming and training
strive4peace2006 at yahoo.com


FatMan wrote:

What I am trying to do is calculate the sum of a control on a sub report that
refeers to some fields on the main report. In the detail section of the sub
report the control calculates the values correctly and it references some
fields on my main form. Yet when I try to calculate the total for the
control in the footer section it treats my reference to the fields on my main
report as paramater values. For the life of me I can not figure out what I
am doing wrong. Can anyone help please?

Main Report Name: rptDailyProductionApples

Sub report Name: rptDailyProductionApplestblWipDistLabsubreport

Control on sub report (in detail section) to be totaled: txtUnitCostProd

Contents of [txtUnitCostProd]:
=Sum(IIf([GlCode]="61269-02",+[Reports]![rptDailyProductionApples]![txtSetUpUnitCost]+[Reports]![rptDailyProductionApples]![txtProductionUnitCost]+[Reports]![rptDailyProductionApples]![txtCleanUpUnitCost],[txtOtherExpenseUnitCost]))

I have tried entering the following with both resulting in the "paramater
value" issue.

=sum([txtUnitCostProd]) and

=sum(IIf([GlCode]="61269-02",+[Reports]![rptDailyProductionApples]![txtSetUpUnitCost]+[Reports]![rptDailyProductionApples]![txtProductionUnitCost]+[Reports]![rptDailyProductionApples]![txtCleanUpUnitCost],[txtOtherExpenseUnitCost]))

Can anyone help pelase?

Thanks,
FatMan
 
S

strive4peace

#Name?
maens that a name is not recognized -- check the NAME
property of your controls. To be on the safe side, do a
copy and paste with them ... maybe they are just too long ;)

it is truly a good idea to keep names concise ...yet
descriptive -- but not too descriptive ;) that is what the
Description (for tables) and StatusBarText (for forms) is for

you can use the TAG property to add developer notes, or for
anything you want -- the system does not use it for anything

Warm Regards,
Crystal
MVP Microsoft Access

remote programming and training
strive4peace2006 at yahoo.com
*
Have an awesome day ;)

Crystal:
Thanks for your help and yes I agree what long names!. However it is the
only way I can keep things straight in my small mind. Do you think it would
help if I shorten the names?

I did a copy and past on your suggestion and I am now getting the following
results:
#Name?

I have checked all the names (reports & controls) in the exspression and
could not find any that were wrong. Any ideas? I have noticed that after I
print preview the report and return back to the exspression that access has
removed the "[" and "]" from around the report name and control in the second
part of the exspression and not the first. What would cuase it to do that?

Any suggestions or help you can offer is greatly appreciated.

Thanks,
FatMan

:

=IIF([rptDailyProductionApplestblWipJobAllMatsubreport].report.hasdata,[rptDailyProductionApplestblWipJobAllMatsubreport].report![txtMatUnitCostProdTotal],0)
+
IIF([rptDailyProductionApplestblWipDistLabsubreport].report.hasdata,[rptDailyProductionApplestblWipDistLabsubreport].report![txtLabUnitCostProdTotal],0)

.... what long names!

Have an awesome day

Warm Regards,
Crystal

MVP Microsoft Access

remote programming and training
strive4peace2006 at yahoo.com

Crystal:
Thank you for your advice. Some how I manage to gt it fixed before your
reply. I deleted all the controls and fields and rewrote all my
exspressions again. Not sure exactly what I did different but it is working.

Can you please take a look at this and offer me any insight you might have
as to what is wrong. Still working with the same report and two sub-reports.
What I now need to to is add the total calculated on each sub report and
display this total on the main report.

Main Report: rptDailyProductionApples
SubReport #1: rptDailyProductionApplestblWipDistLabsubreport
SubReport #2: rptDailyProductionApplestblWipJobAllMatsubreport
Control from Subreport #1: txtLabUnitCostProdTotal
Control From Subreport #2 txtMatUnitCostProdTotal

I have used the exspression builder to create the following exspression:
=[Reports]![rptDailyProductionApplestblWipJobAllMatsubreport]![txtMatUnitCostProdTotal]
+
[Reports]![rptDailyProductionApplestblWipDistLabsubreport]![txtLabUnitCostProdTotal]

The above yields the following results: #Name?

When I include the main report's name in the above exspression (between
[Reports] and [rptDailyProductionApples...]) it yields the follwoing results:
#Error

Can you or anyone else please help me with this?

Thanks,
FatMan







:



instead of

[Reports]![rptDailyProductionApples]![txtSetUpUnitCost]

try

nz(parent.txtSetUpUnitCost,0)

I also wrapped it with NZ in case it is null

don't forget to put a space on both side of your operators (
ie: + )

It is a good habit and some operators, like &, may not
function right unless they are delimited

Have an awesome day

Warm Regards,
Crystal

MVP Microsoft Access

remote programming and training
strive4peace2006 at yahoo.com


FatMan wrote:


What I am trying to do is calculate the sum of a control on a sub report that
refeers to some fields on the main report. In the detail section of the sub
report the control calculates the values correctly and it references some
fields on my main form. Yet when I try to calculate the total for the
control in the footer section it treats my reference to the fields on my main
report as paramater values. For the life of me I can not figure out what I
am doing wrong. Can anyone help please?

Main Report Name: rptDailyProductionApples

Sub report Name: rptDailyProductionApplestblWipDistLabsubreport

Control on sub report (in detail section) to be totaled: txtUnitCostProd

Contents of [txtUnitCostProd]:
=Sum(IIf([GlCode]="61269-02",+[Reports]![rptDailyProductionApples]![txtSetUpUnitCost]+[Reports]![rptDailyProductionApples]![txtProductionUnitCost]+[Reports]![rptDailyProductionApples]![txtCleanUpUnitCost],[txtOtherExpenseUnitCost]))

I have tried entering the following with both resulting in the "paramater
value" issue.

=sum([txtUnitCostProd]) and

=sum(IIf([GlCode]="61269-02",+[Reports]![rptDailyProductionApples]![txtSetUpUnitCost]+[Reports]![rptDailyProductionApples]![txtProductionUnitCost]+[Reports]![rptDailyProductionApples]![txtCleanUpUnitCost],[txtOtherExpenseUnitCost]))

Can anyone help pelase?

Thanks,
FatMan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top