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

B

bandwood1

From within the report_detail event, how can I tell if I'm processing
the last record for the report?
 
J

John Spencer

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
 
B

bandwood1

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top