Last Value

  • Thread starter Thread starter Ruben Granados
  • Start date Start date
R

Ruben Granados

Is there a way to know when the last record of the Details
section is being sent?
I want to catch it on the Details on format event.
For my design I need to set the move layout to False. but
i need also to send values to some unbound text to avoid
this values to be overlapped I need something like:

If me.LastRecord = True Then
.... set values
End if

thx
 
Access does not give you this information.

As a workaround, use the Open event procedure of the report to lookup the
primary key value for the last record into a module-level variable (one
declared at the top of the module with the option statements).

Adjusting for any sorting or filtering is the toughest part: unfortunately
Access fails to set the report's FilterOn property correctly, so you cannot
tell whether the string in its Filter property is actually applied or is an
artifact from a previous occasion.
 
I've tried setting the values from the Group Footer Format
event. But no data is set. This happens because is not
possible to set data from the Footer to the details
section or is a syntax mistake?
my sintax:

Private Sub GroupFooter0_Format(Cancel As Integer,
FormatCount As Integer)
.....
Me.txtNo1 = Value 1
Me.txtNo2 = Value 2
....

End Sub

Thank you for your response.
 
Ruben said:
Is there a way to know when the last record of the Details
section is being sent?
I want to catch it on the Details on format event.
For my design I need to set the move layout to False. but
i need also to send values to some unbound text to avoid
this values to be overlapped I need something like:

If me.LastRecord = True Then
... set values
End if

You can use a text box named txtTotalDetails in the report's
(or a group's) header section with the expression =Count(*)
to tell you the number of details in the report (or group).

Then use a text box named txtLineNum in the detail section.
Set its control source expression to =1 and RunningSum
property to Over All (or Over Group). This will tell you
which detail is being formatted.

Now, you can use code in the Detail section's Format event
to perform special handling of the last detail in the report
(or group):

If Me.txtLineNum = Me.txtTotalDetails Then
'set values ...
Me.MoveLayout = False
End If
 
What you are attempting should work if:
- txtNo1 is unbound (no control source), and
- it is in the GroupFooter0 section (the section being formatted).
 
Back
Top