goldenmusketeer Level: Whizz Kid

 Registered: 23-12-2004 Posts: 16
|
Parameterized command in Crystal Report 9
Helloooo...
I am using Crystal Report 9 and VB6 to design a report..
I am using OLEDB connection to connect to report...
Then I created a command by cliking on "COMMAND" tab
This command is a parameterized one which is given below...
"SELECT * FROM COmpany WHERE compid='{?compid}'
Now I am calling the report from program like this --
Option Explicit
Dim Tables As CRAXDRT.DatabaseTables
Dim Csprop As CRAXDRT.ConnectionProperties
Dim Cs As CRAXDRT.ConnectionProperty
Dim cpars As CRAXDRT.ParameterFieldDefinitions
Dim cpar As CRAXDRT.ParameterFieldDefinition
Private Sub Form_Load()
Call ReportSetConn
End Sub
Public Sub ReportSetConn()
Dim rptobj As CRAXDDRT.Report
Set rptobj = New CrystalReport1
Screen.MousePointer = vbHourglass
CRViewer.DisplayGroupTree = False
Set Tables = rptobj.Database.Tables
Set Csprop = Tables.Item(1).ConnectionProperties
Csprop.Item("Provider") = "SQLOLEDB"
Csprop.Item("Data Source") = "SERVER"
Csprop.Item("Initial Catalog") = "TESTDATABASE"
Dim prval As CRAXDDRT.ParameterValues
prval.
With rptobj
.ParameterFields(1).AddCurrentValue ("0001")
End With
Screen.MousePointer = vbHourglass
CRViewer.ReportSource = rptobj
CRViewer.ViewReport
Screen.MousePointer = vbDefault
End Sub
|
No errors are given but not data are displayed, even if table contains data..But after report is displayed and if I then enter parameter value through the prompt then the values aare displayed....
Bottomline is parameter is not getting any value when the value is send through VB6 code....
WHAT TO DO 
____________________________
.....Joy
|