Counting in subreports and showing on main report

G

Guest

I have a main report, rptEmployees. The sub is subrptEmployeeDegrees. They
have different queries and are linked by txtParticipantId. I counted the
employees [txtEmployees] on the main report footer (223). I counted the
number of degrees [txtDegrees] in the subreport (120) footer but I need the
subreport value to be on the main report so I can divide it by the employee
count. I tried a text box[txtDegreeCount] in the detail section of the main
report with the Running Sum Property set to Over All and the following.

=[subrptEmployeeDegrees].[Report].[txtDegrees]

I get a zero and the brackets disappear.
 
G

Guest

Ann said:
I have a main report, rptEmployees. The sub is subrptEmployeeDegrees. They
have different queries and are linked by txtParticipantId. I counted the
employees [txtEmployees] on the main report footer (223). I counted the
number of degrees [txtDegrees] in the subreport (120) footer but I need the
subreport value to be on the main report so I can divide it by the employee
count. I tried a text box[txtDegreeCount] in the detail section of the main
report with the Running Sum Property set to Over All and the following.

=[subrptEmployeeDegrees].[Report].[txtDegrees]

I get a zero and the brackets disappear.

I guess I know why I'm getting a zero. If I run the subreport I get counts.
If I run the main report the count on the subreport is zero. Why is the
number changing from the correct number to a zero?
 
M

Marshall Barton

Ann said:
I have a main report, rptEmployees. The sub is subrptEmployeeDegrees. They
have different queries and are linked by txtParticipantId. I counted the
employees [txtEmployees] on the main report footer (223). I counted the
number of degrees [txtDegrees] in the subreport (120) footer but I need the
subreport value to be on the main report so I can divide it by the employee
count. I tried a text box[txtDegreeCount] in the detail section of the main
report with the Running Sum Property set to Over All and the following.

=[subrptEmployeeDegrees].[Report].[txtDegrees]

I get a zero and the brackets disappear.

I guess I know why I'm getting a zero. If I run the subreport I get counts.
If I run the main report the count on the subreport is zero. Why is the
number changing from the correct number to a zero?


This is just a stab in the dark, but double check the
subreport control's LinkMaster/Child properties.

Also note that is any employee has no degree records, the
main report total (in the detail section) will be #Error.
To deal with this possibility the text box sould use the
expression:

=IIf(subrptEmployeeDegrees.Report.HasData,
subrptEmployeeDegrees.Repor.txtDegrees, 0)
 
G

Guest

I did manage to fix the zero problem last night at home. I recreated all the
counts and they worked. I must have had something wrong that I just couldn't
see.

You must be a mind reader though because the next thing that happened was
the #Error in the totals but I had your post this morning and that worked
great. Thank you so much for your help.

Marshall Barton said:
Ann said:
I have a main report, rptEmployees. The sub is subrptEmployeeDegrees. They
have different queries and are linked by txtParticipantId. I counted the
employees [txtEmployees] on the main report footer (223). I counted the
number of degrees [txtDegrees] in the subreport (120) footer but I need the
subreport value to be on the main report so I can divide it by the employee
count. I tried a text box[txtDegreeCount] in the detail section of the main
report with the Running Sum Property set to Over All and the following.

=[subrptEmployeeDegrees].[Report].[txtDegrees]

I get a zero and the brackets disappear.

I guess I know why I'm getting a zero. If I run the subreport I get counts.
If I run the main report the count on the subreport is zero. Why is the
number changing from the correct number to a zero?


This is just a stab in the dark, but double check the
subreport control's LinkMaster/Child properties.

Also note that is any employee has no degree records, the
main report total (in the detail section) will be #Error.
To deal with this possibility the text box sould use the
expression:

=IIf(subrptEmployeeDegrees.Report.HasData,
subrptEmployeeDegrees.Repor.txtDegrees, 0)
 

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