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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

rename subreport 1

Status
Not open for further replies.

Ravala

Programmer
Jan 28, 2004
88
US
How can I rename subreport name?
 
Ana one more thing,
how can I make sure field has 12 characters ?
 
In Crystal 8.5, you can't change a subreport name. I believe Crystal 9 allows it.

As for your second question, it is not clear to me what you are after. If you want the first 12 characters of a field, then
left({your.field}, 12)

Madawc Williams
East Anglia, Great Britain
 
You can change the display of the subreport name in the tab, by right clicking the subreport->format subreport->subreport->subreport preview tab caption->x+2 and entering the new name in quotes.

If you are using an on-demand subreport, you can change the displayed link by using the other x+2 formula area to enter a string.

-LB
 
In 8.0, once you have changed the caption, you must close any open subreport tabs, save your changes and then double click on the subreport to see the new caption. I just double checked this and it does work. What does NOT get changed is the name of the subreport object itself (look in design mode to see that this is true).

You can also change the tooltip text in preview to correspond to your new title by going to format subreport->common->tool tip text->x+2 and entering the desired text there. The tool tip will still show the original subreport name while in design mode.

-LB
 
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim cr As New CRAXDDRT.Application
Dim rpt As CRAXDDRT.Report
Dim r2 As CRAXDDRT.Report
Dim sec As CRAXDDRT.Section
Dim sbr As CRAXDDRT.SubreportObject
Dim sFile As String
Dim sF1 As String
Dim sF2 As String
Dim sPath As String
Dim sTRGPath As String
Dim newName As String

sTRGPath = "C:\reports\"

sPath = "C:\dev source\gideons\reports\"

Me.OpenFileDialog1.Filter = "CRX|CNI*.rpt"
Me.OpenFileDialog1.InitialDirectory = sPath
Me.OpenFileDialog1.ShowDialog()
sF1 = Me.OpenFileDialog1.FileName
sF2 = sTRGPath & sF1.Substring(30)
newName = Me.OpenFileDialog1.FileName
newName = newName.Substring(42)
newName = newName.Substring(0, newName.Length - 4)
rpt = cr.NewReport()
rpt.PaperOrientation = CRAXDDRT.CRPaperOrientation.crLandscape

sbr = rpt.Sections(2).ImportSubreport(sF1, 0, 0)

sbr.SubreportName = newName
If Dir(sF2) <> "" Then Kill(sF2)
rpt.SaveAs(sF2, CRAXDDRT.CRReportFileFormat.cr80FileFormat)

MsgBox(sbr.SubreportName.ToString() & " " & sF2)

sbr = Nothing
sec = Nothing
rpt = Nothing
cr = Nothing



End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top