Report Detail Event - How can I tell (from within VBA) that I'm onthe last record.

  • Thread starter Thread starter bandwood1
  • Start date Start date
B

bandwood1

From within the report_detail event, how can I tell if I'm processing
the last record for the report?
 
Add a control to the detail section
Control Source: =1
Running Sum: OverAll
Visible: No
Name: tLineCounter

Add a control to the report's header
Control Source: = Count(*)
Visible: No
Name: tRecordCount

In the format event of the detail section add

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)

If me.tLineCounter = me.tRecordCount Then
'Printing last record, so do something
end If

End Sub

By the way, you really needed to post this just to one group -
microsoft.public.access.reports

Posting it to several is overkill and is generally a waste of others time.
Someone else may give you the same response in one of the other groups.
John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County
 
Add a control to the detail section
Control Source: =1
Running Sum: OverAll
Visible: No
Name: tLineCounter

Add a control to the report's header
Control Source: = Count(*)
Visible: No
Name: tRecordCount

In the format event of the detail section add

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)

If me.tLineCounter = me.tRecordCount Then
    'Printing last record, so do something
end If

End Sub

By the way, you really needed to post this just to one group -
microsoft.public.access.reports

Posting it to several is overkill and is generally a waste of others time..
Someone else may give you the same response in one of the other groups.
John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County





- Show quoted text -

Thanks tis works, but I was hoping for something a little more
intrinsic (ie a property or attibute of the report_detail object or
something.
 
Back
Top