pepsisc
April 30th, 2006, 03:44 PM
OS = Windows XP Pro; Visual Basic 6 Enterprise Edition; Crystal Report XI Developer Edition
In a VB6 App, I am selecting what report to print based upon a ReportName and ReportType. The report is selected by using a If...ElseIf...End If.
My objective is to put a different heading on each report. In the Crystal Report Design, I created a formula called "Heading" -no syntax defined as a string. Then dragged into the PageHeader section. It's not working. I am getting a "Type Mismatch" error.
In the Global Module, I have:
Public ReportHeading1 As String 'Used on Form1 -- Title line
Public ReportType As String
Public ReportName As String
Sub Report-it ()
Dim dbTable As CRAXDDRT.DatabaseTable
If ReportName = "AllContractReport.rpt" And ReportType = "All" Then
Set craxreport = craxapp.OpenReport(ReportPath & "\" & ReportName)
ReportHeading1 = "This is a list of all PO's in the Tracking Database."
craxreport.FormulaSyntax = "heading = " & Chr(34) & ReportHeading1 & Chr(34)
ElseIf ReportName = "AllContractReport.rpt" And ReportType = "Contract" Then
.
.
end if
dbTable.Location = "E:\Data\Orion\TestServer\TrackingDB.mdb"
' ==============================================================================
Screen.MousePointer = vbHourglass
CrystalActiveXReportViewer1.Refresh
Call CrystalActiveXReportViewer1_RefreshButtonClicked(True)
CrystalActiveXReportViewer1.ReportSource = craxreport
CrystalActiveXReportViewer1.ViewReport
Set craxreport = Nothing
Screen.MousePointer = vbDefault
End Sub
Thanks,
Sam
In a VB6 App, I am selecting what report to print based upon a ReportName and ReportType. The report is selected by using a If...ElseIf...End If.
My objective is to put a different heading on each report. In the Crystal Report Design, I created a formula called "Heading" -no syntax defined as a string. Then dragged into the PageHeader section. It's not working. I am getting a "Type Mismatch" error.
In the Global Module, I have:
Public ReportHeading1 As String 'Used on Form1 -- Title line
Public ReportType As String
Public ReportName As String
Sub Report-it ()
Dim dbTable As CRAXDDRT.DatabaseTable
If ReportName = "AllContractReport.rpt" And ReportType = "All" Then
Set craxreport = craxapp.OpenReport(ReportPath & "\" & ReportName)
ReportHeading1 = "This is a list of all PO's in the Tracking Database."
craxreport.FormulaSyntax = "heading = " & Chr(34) & ReportHeading1 & Chr(34)
ElseIf ReportName = "AllContractReport.rpt" And ReportType = "Contract" Then
.
.
end if
dbTable.Location = "E:\Data\Orion\TestServer\TrackingDB.mdb"
' ==============================================================================
Screen.MousePointer = vbHourglass
CrystalActiveXReportViewer1.Refresh
Call CrystalActiveXReportViewer1_RefreshButtonClicked(True)
CrystalActiveXReportViewer1.ReportSource = craxreport
CrystalActiveXReportViewer1.ViewReport
Set craxreport = Nothing
Screen.MousePointer = vbDefault
End Sub
Thanks,
Sam