Do not show records in Footer if Count(*)=1

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

Guest

I have a report that has a field [Account] that is a Header/Footer group. I
have 3 Textboxes that Sum() 3 fields in the Footer section of [Account]. If
the count(*) for the detail of an [Account] group = 1 , Then I do not want to
show the Sum() Textboxes in the Footer because it would be summing only one
item and looks cumbersome, but if the count(*) > 1 then I want to show the
TextBoxes in the Footer that Sums that [Account] group. How do I accomplish
this?

Thank you for your help.

Steven
 
add an unbound textbox control (i'll call it txtCount) to the Footer
section; set its' Visible property to No and set its' ControlSource property
to

=Count(*)

add the following code to the section's Format event procedure, as

Me!TextboxName.Visible = (Me!txtCount > 1)
Me!TextboxName1.Visible = (Me!txtCount > 1)

replace TextboxName and TextboxName1 with the correct names of the "Sum()"
textboxes in the Footer section, of course.

note that if those textboxes are the only controls in the Footer section,
you may want to hide the section entirely, so as not to leave big blank
spaces in the report. to do this, click on the section in design view, and
look at the Name property to get the correct name of the section. then add
the following code to the section's Format event procedure, as

Me.GroupFooterName.Visible = (Me!txtCount > 1)

substitute the correct name of the section, of course.

hth
 
You can add code to the On Format event of the Header or Footer like:
Cancel = Me.txtGroupCount = 1
 
Back
Top