Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Reports / Printing / October 2004

Tip: Looking for answers? Try searching our database.

Checking for last detail record to change formatting

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Max Moor - 31 Oct 2004 07:31 GMT
Hi All,
       I'm trying to do an org chart, of sorts.  A subreport, linking to the
main report with master and child fields, is used to show the "second
level" management below the top level people.  The subreport draws
connector lines, like in an MS explorer file tree display.

       The problem is that the last record in the second level (sub-report)
draws the same connector lines, even though there is no next-second-level-
person following.  I have this dangling, attaches-to-nothing line left
over.

       Is there a way, in VB code, maybe in the detail format event code of
the subreport, to detect that the subreport is displaying the last record
of the master's set?  That way, I can set the lines .Visible property off,
and have the lines terminating with the last record, as expected.

- Max
Marshall Barton - 31 Oct 2004 17:44 GMT
>        I'm trying to do an org chart, of sorts.  A subreport, linking to the
>main report with master and child fields, is used to show the "second
[quoted text clipped - 10 lines]
>of the master's set?  That way, I can set the lines .Visible property off,
>and have the lines terminating with the last record, as expected.

You can determine the last record in a report by adding a
text box (name it txtTotalLines) to the report's header
section with the expression =Count(*)

To determine which record you're working on, add a text box
(name this one txtLineNum) to the detail section.  Set tis
control source expression to =1 and RunningSum property to
Over All.

With all that in place the subreport's detail format event
can use something like this air code:

    If Parent.txtLineNum = Parent.txtTotalLines Then
        '  last detail in main report
    Else
        ' all other details
    End If

Signature

Marsh
MVP [MS Access]

Max Moor - 31 Oct 2004 21:37 GMT
> You can determine the last record in a report by adding a
> text box (name it txtTotalLines) to the report's header
[quoted text clipped - 13 lines]
>           ' all other details
>      End If

Very cool!  Thanks Marsh.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.