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

Passing a Title to Crystal Reports

Status
Not open for further replies.

SirPaladin

Programmer
Jul 9, 1999
32
0
0
US
Does anyone know how to dynamically pass a Title to Crystal Reports (ver. 6)? The Help in Crystal Reports is rather pathetic.
 
<br>
Amen...<br>
<br>
It took me forever and several user groups to figure it out. Unfortunatly, I've yet to try it. What was suggested to me was:<br>
<br>
CrystalReport1.Formulas(0) = "Headline=""your_data""<br>
<br>
then in the Crystal Report, make a formula called "HeadLine" and you can place the formula field wherever you like.<br>
<br>
Again, I've yet to try it.
 
I tried that method with the Formulas. Maybe I was doing it wrong, but it didn't work. Experimenting some more, I found a way to do it. It assumes your CrystalReport1 designer was renamed "PeopleDetail" and that you had already created a SQL statement to select your records for the report stored in ReportSQL, and user supplied title for the report in ReportTitle$:<br>
<br>
Dim Report As New PeopleDetail<br>
<br>
Option Explicit<br>
________________________________________________<br>
Private Sub Form_Load()<br>
Dim rs As New ADODB.Recordset<br>
<br>
If Len(ReportSQL$) = 0 Then<br>
MsgBox "Recordset not selected yet. Use the Query form first"<br>
Unload Me<br>
End If<br>
<br>
'Use this SQL statement to select the records to use<br>
rs.Open ReportSQL$, _<br>
"DSN=" & DSN$ & ";", adOpenKeyset<br>
Report.Database.SetDataSource rs<br>
<br>
If Len(ReportTitle$) = 0 Then<br>
Report.ReportTitle = "Detailed Personal Report"<br>
Else<br>
Report.ReportTitle = ReportTitle$<br>
ReportTitle$ = ""<br>
End If<br>
<br>
'CRViewer1.Name = "Test Name"<br>
CRViewer1.DisplayGroupTree = False<br>
CRViewer1.ReportSource = Report<br>
CRViewer1.ViewReport<br>
<br>
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top