Hi Will,
To a count of the detail records in a group from within VBA, we can use the
group format event, and detail format event; for each group, the number of
calling detail format event is the number of the records in the group, in
other words, detail format event fires for each record; therefore, we can
put a variable in detail format event and increate it by one each time, and
then use the variable in groupfooter format event.
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
numcount = numcount + 1
End Sub
Please feel free to reply to the threads if you have any concerns or
questions.
Sincerely,
Alick Ye, MCSD
Product Support Services
Microsoft Corporation
Get Secure! - <
www.microsoft.com/security>
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
| From: will eichert <
[email protected]>
| X-Tomcat-NG: microsoft.public.access.reports
|
| No, that didn't seem to work for me. Maybe I was doing it incorrectly,
| but I couldn't figure out a way to get a count of the detail records
| in a group from within VB.
|
| What did work was to place an invisible text box (I called it
| grouprecordcount, pretty clever name, eh?) in the group footer, whose
| data source is "= Count(*)". Then in VB in the group footer's Format
| event,
|
| If grouprecordcount <= 1 Then
| Me.PrintSection = False
| Me.MoveLayout = False
| Else
| Me.PrintSection = True
| Me.MoveLayout = True
| End If
|
| Will
|
| On Tue, 7 Oct 2003 03:47:54 -0700, "Jeff Boyce" <
[email protected]>
| wrote:
|
| >Will
| >
| >My bad! Use IF() in VB (IIF() in a query).
| >
| >Would using Count([MyDetailControlName]) get what you're looking for?
| >
| >Jeff Boyce
| ><Access MVP>
|
|