Summing an unbound text box in report

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have an unbound text box, called [NoSchools] in the detail section of a
report that gets it's data from Select Case statements in the onprint event .
I want to be able to find the sum of the numbers in this text box, but can't
because it is an unbound text box in a report. The report is based upon a
query.

Any help will be appreciated.

- Steve
 
-Create a modular-level "running total" variable in your report module
(available to all procedures within the module).
-When your Select Case assigns a value to the Detail textbox, increment the
RT variable by the same amount.
-Assign the RT value to the appropriate textbox(s) in your Footer(s)
OnFormat or OnPrint event.
-If you need both a "group" RT and a GrandTotal RT, create 2 variables to
increment but reset the Group RT to zero after setting your Group Footer
textbox, etc.

HTH,
 
I am relatively new to this level of database design. Can you be more
specific about how I might do that?

- Steve

George Nicholson said:
-Create a modular-level "running total" variable in your report module
(available to all procedures within the module).
-When your Select Case assigns a value to the Detail textbox, increment the
RT variable by the same amount.
-Assign the RT value to the appropriate textbox(s) in your Footer(s)
OnFormat or OnPrint event.
-If you need both a "group" RT and a GrandTotal RT, create 2 variables to
increment but reset the Group RT to zero after setting your Group Footer
textbox, etc.

HTH,
--
George Nicholson

Remove 'Junk' from return address.


Steve Albert said:
I have an unbound text box, called [NoSchools] in the detail section of a
report that gets it's data from Select Case statements in the onprint
event .
I want to be able to find the sum of the numbers in this text box, but
can't
because it is an unbound text box in a report. The report is based upon a
query.

Any help will be appreciated.

- Steve
 
For a Running Total that appears only in the Report Footer (aircode):

1) At the top of your report module (between "Option Explicit" and the first
Sub/Function):
Private sngRunTotal as Single

2) If I understand your OP, you should already have something like:
Me.txtNoSchools = somevalue
within, or perhaps following, your Select Case statement in the code for the
Detail_Print event.
Insert the following after that line (after every occurance of that line, if
its within the Select Case) :
sngRunTotal = sngRunTotal + somevalue (or sngRunTotal = sngRunTotal +
Me.txtNoSchools)

3) I don't know where you want to display the RunningTotal when done, but
I'll assume it's in a textbox in the ReportFooter.
Within the code for the Print event for the ReportFooter section:
Me.txtNoSchoolsGT = sngRunTotal

HTH,
--
George Nicholson

Remove 'Junk' from return address.


Steve Albert said:
I am relatively new to this level of database design. Can you be more
specific about how I might do that?

- Steve

George Nicholson said:
-Create a modular-level "running total" variable in your report module
(available to all procedures within the module).
-When your Select Case assigns a value to the Detail textbox, increment
the
RT variable by the same amount.
-Assign the RT value to the appropriate textbox(s) in your Footer(s)
OnFormat or OnPrint event.
-If you need both a "group" RT and a GrandTotal RT, create 2 variables to
increment but reset the Group RT to zero after setting your Group Footer
textbox, etc.

HTH,
--
George Nicholson

Remove 'Junk' from return address.


Steve Albert said:
I have an unbound text box, called [NoSchools] in the detail section of
a
report that gets it's data from Select Case statements in the onprint
event .
I want to be able to find the sum of the numbers in this text box, but
can't
because it is an unbound text box in a report. The report is based upon
a
query.

Any help will be appreciated.

- Steve
 
George,

Thanks for your response. I have a couple of questions:

1. I want to sum by Group and then a Grand Total.

2. Where does the RunTotal textbox go and what is the Me.txtNoSchoolsGT
control and where does that go? Also, would these two controls be unbound?

Thanks.

- Steve


George Nicholson said:
For a Running Total that appears only in the Report Footer (aircode):

1) At the top of your report module (between "Option Explicit" and the first
Sub/Function):
Private sngRunTotal as Single

2) If I understand your OP, you should already have something like:
Me.txtNoSchools = somevalue
within, or perhaps following, your Select Case statement in the code for the
Detail_Print event.
Insert the following after that line (after every occurance of that line, if
its within the Select Case) :
sngRunTotal = sngRunTotal + somevalue (or sngRunTotal = sngRunTotal +
Me.txtNoSchools)

3) I don't know where you want to display the RunningTotal when done, but
I'll assume it's in a textbox in the ReportFooter.
Within the code for the Print event for the ReportFooter section:
Me.txtNoSchoolsGT = sngRunTotal

HTH,
--
George Nicholson

Remove 'Junk' from return address.


Steve Albert said:
I am relatively new to this level of database design. Can you be more
specific about how I might do that?

- Steve

George Nicholson said:
-Create a modular-level "running total" variable in your report module
(available to all procedures within the module).
-When your Select Case assigns a value to the Detail textbox, increment
the
RT variable by the same amount.
-Assign the RT value to the appropriate textbox(s) in your Footer(s)
OnFormat or OnPrint event.
-If you need both a "group" RT and a GrandTotal RT, create 2 variables to
increment but reset the Group RT to zero after setting your Group Footer
textbox, etc.

HTH,
--
George Nicholson

Remove 'Junk' from return address.


I have an unbound text box, called [NoSchools] in the detail section of
a
report that gets it's data from Select Case statements in the onprint
event .
I want to be able to find the sum of the numbers in this text box, but
can't
because it is an unbound text box in a report. The report is based upon
a
query.

Any help will be appreciated.

- Steve
 
Back
Top