Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Selective Subreports Depending on Group

Status
Not open for further replies.
May 7, 1999
130
US
Hi!

This should be easy for an expert!

I have a report that contains a hierarchy of groupings in order of most to least significant and known as index, subindex, project, subproject, and [development] stage. The client now wants detail data to be handled differently (i.e., a different set of column headings) depending on the value of project. In other words, I want to choose which format is applied to a given project. Can I choose which subreport to use and how?

Heretofore, I had three subreports each of which handled one of the three development stages, called Completed, Expansion and Development. The subreports were each minimized to just a sliver of a line and then stacked one on top of the other so that if we were in stage "C", then subreport "C" using the "can grow" property would handle the items; if stage "E", then subreport "E" would handle the items, etc. This sort of works, but it's a real pain to expand the format in design view each time, so I may be missing something here.

The new wrinkle (described above) is that in stages "E" or "D" a different format (different headings and different width columns) is used depending on the kind of project.

There's got to be some clever way to handle this mess. It's driving me nutty.

Hope you can help.

Thanks!

John Harkins
 
If only one subreport may show up at a time, you could use just one control and change the SourceObject property at runtime depending on what's in a textbox showing the stage:

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Dim varSubReportName As String
Select Case [YourTextBoxName]
Case "E"
varSubReportName = "NameOfSubReportForCaseE"
Case "C"
varSubReportName = "NameOfSubReportForCaseC"
Case "D"
varSubReportName = "NameOfSubReportForCaseD"
Case Else
'Whatever you want to happen in other cases
End Select
Me.[SubReportName].SourceObject = varSubReportName
End Sub

You may need to play a little with the LinkChildFields property...

Good luck



[pipe]
Daniel Vlas
Systems Consultant

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top