Connecting Tech Pros Worldwide Help | Site Map

Referring to a specific column in a subreport control from a textbox on the main report...

MLH
Guest
 
Posts: n/a
#1: Jun 15 '06
I have a report and on it, a subreport control

Main Report Name: rptInvoiceMain
Sub Report Name: rptInvoiceSubReport
SubReport Control Name: rptInvoiceSubReportCtl

The subreport contains 2 fields - a text field where line items
sold are listed and a currency field where the price per item
is shown. The subreport control displays these two fields
when the main report is opened.

I have a textbox on the main report where I wish to display
the total dollar amount of subreport column #2. Here is my
controlsource property setting for that textbox:

=Sum([Reports]![Orders]![rptInvoiceSubReportCtl].[Report].[ProcFee])

I'm getting an error. What have I done wrong here?
Cilla
Guest
 
Posts: n/a
#2: Jun 15 '06

re: Referring to a specific column in a subreport control from a textbox on the main report...


MLH wrote:[color=blue]
> I have a report and on it, a subreport control
>
> Main Report Name: rptInvoiceMain
> Sub Report Name: rptInvoiceSubReport
> SubReport Control Name: rptInvoiceSubReportCtl
>
> The subreport contains 2 fields - a text field where line items
> sold are listed and a currency field where the price per item
> is shown. The subreport control displays these two fields
> when the main report is opened.
>
> I have a textbox on the main report where I wish to display
> the total dollar amount of subreport column #2. Here is my
> controlsource property setting for that textbox:
>
> =Sum([Reports]![Orders]![rptInvoiceSubReportCtl].[Report].[ProcFee])
>
> I'm getting an error. What have I done wrong here?[/color]

Hi MLH,

Normally I would do my summing on the Sub report under a group header
such as the report footer (one the sub report). I would then let the
sub report grow as needed in the main report. The control that sums
column 2 would appear at the bottom of the sub report which would then
appear on the main report from the sub report.

You could also sum the column in a new control on the sub report under
the report footer, hide it there and reference the hidden control in
another control on the main report.

If you try to sum the column the way you are doing it you will get
#Error. You must sum the column in the sub report first. then you can
try any one of the sugestions above I gave you.

Have a great day

Cilla

MLH
Guest
 
Posts: n/a
#3: Jun 15 '06

re: Referring to a specific column in a subreport control from a textbox on the main report...


Yes, Cilla, it worked much better
performing the summation on the
subreport first. Thank-you.
MLH
Guest
 
Posts: n/a
#4: Jun 15 '06

re: Referring to a specific column in a subreport control from a textbox on the main report...


Can you also tell me how to 'fix' the field widths
on the subreport. My subreport default view is
datasheet view. I wish to make the first of the
two columns about an inch wider.

I've tried opening the subreport in design view
and modifying the textbox control width. No luck.
I've also tried opening it in datasheet view, resizing
the fields and saving in their resized state. Didn't
do the trick either. Hmmm???
Cilla
Guest
 
Posts: n/a
#5: Jun 15 '06

re: Referring to a specific column in a subreport control from a textbox on the main report...



MLH wrote:[color=blue]
> Can you also tell me how to 'fix' the field widths
> on the subreport. My subreport default view is
> datasheet view. I wish to make the first of the
> two columns about an inch wider.
>
> I've tried opening the subreport in design view
> and modifying the textbox control width. No luck.
> I've also tried opening it in datasheet view, resizing
> the fields and saving in their resized state. Didn't
> do the trick either. Hmmm???[/color]

Are you talking forms or reports. Forms have default views for sub
forms not reports?

Yes there is a way to set the width of fields in a subform that is
displayed in datasheet view. Open the sub form in datasheet view and
size your field to the size you wish then click the save button. when
you open the main form the new size of the field in the sub form should
be set.

I also have noticed if you size the field of a subform within the main
form and click the save button a couple of times it will also save the
size you set. (sometimes)

Closed Thread