You didn't say CR version, anyway I'll assume that you are using RDC
You could do it using formula fields
In the rpt
Insert a formula field in the page header section, lets say @Title
Code:
Trim("Here goes title")
In vb6 code
(You need to reference Crystal ActiveX Report Viewer Library)
Code:
Dim MEnt1 As Integer
Dim CRApplication As New CRAXDRT.Application
Dim CRReport As New CRAXDRT.Report
'
'code goes here
'
Set CRReport = CRApplication.OpenReport("MyRpt.rpt", 1)
'
'
'
For MEnt1 = 1 To CRReport.FormulaFields.Count
Select Case CRReport.FormulaFields(MEnt1).name
Case "{@Title}"'this is name of the formula in CR
CRReport.FormulaFields(MEnt1).Text = "Trim(" & Chr(39) & "ACME Housing Development." & Chr(39) & ")"
Case "{@XXX}"
CRReport.FormulaFields(MEnt1).Text = "something else"
End Select
Next MEnt1
In vb.net code
Code:
'You need to declare variables and CR objects
For Ment1 = 0 To CRReport.DataDefinition.FormulaFields.Count - 1
Select Case CRReport.DataDefinition.FormulaFields.Item(CRCount).Name.ToString
Case "Title" : CRReport.DataDefinition.FormulaFields.Item(MEnt1).Text = "Trim(" & Chr(39) & "ACME Housing Development." & Chr(39) & ")"
Case "b" : CRReport.DataDefinition.FormulaFields.Item(MEnt1).Text = "any aother value"
End Select
Next MEnt1
This is an example in how to pass a text to a rpt using formula fields