Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

report calculation questions 2

Status
Not open for further replies.

eelsar

Technical User
May 20, 2002
36
0
0
US
1. How would I put in the footer of the report the total number of records in this report?

2. I have a text box on my form that the user enters how many family members are attending a specific event.
How would I put on my report - a total of everyone attending this event (a running total of every entry of family members attending event).

thank you


 
To report the number of records in the report, add a textbox control to the ReportFooter with the following:

=Count(*)

To get a grand total of the number of attendees, add another textbox control to the ReportFooter with the following:

=Sum([attendees])

where [attendees] is the name of the control in your Detail Section that displays the number of attendees input on each record.

[shadeshappy] Cruising the Information Superhighway
[sub] (your mileage may vary)[/sub]
 
In your report footer, create a new text box. For the control source (goto the property sheet) type in
=DCOUNT("FieldName","TableName")
Pick a field that appears on every record.

The answer to the second question is same as first but use the DSUM function.

Neil
 
Thank you both for your responses - I tried both ways and it worked.

I have another question,

how would I get a total based on a control, for example how many children attending event based on a checkbox called children that are all checked off as yes. (this is in addition to the total families attending event - I would want to see breakdown of all different types of people attending event)

thank you again.
 
If you want to count how many check boxes are checked, you could do this.
Name all your check boxes in order - check1, check2, check3 etc.. If you do this, then it's easy.

Dim counta As Integer
For i = 1 to (NUMBER OF CHECK BOXES)
If Me("check" & i) = true Then counta = counta + 1
Next i
Me![SomeTextBox] = counta
 
A good way to "cheat" when trying to count checkboxes is to take the absolute value of the sum of the checkboxes!

Since a checkbox is either True (-1) or False (0), summing the checkbox yields either a zero or a negative value. Taking the absolute value of the result gives you a count of the number of True checkboxes. For example:

=Abs(Sum(Me.chkboxcontrolname))

will count the number of true values in the control named chkboxcontrolname.


[shadeshappy] Cruising the Information Superhighway
[sub] (your mileage may vary)[/sub]
 
Wemeier,
the idea of taking the absolute values of the sum of checkboxes was a great one. It worked.
thank you

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top