how to show tha vb combo values in report
Hi,
i am new to crystal reports.i want to pass a value as a parameter to crystal report which is selected in my vb application combo box.can i do this.If so please tell me.
i was created one crystal report with parameter StaffID.
which is a field in StaffDetails table. i want to pass the parameter StaffID from my vb application without prompting.
thanks a lot
wizkid
my code is :this is not working .i don't know how can i write this type of question
VB Code:
Private Sub ViewReport_Click()
'Add reference to Crystal Reports x.x ActiveX Designer RunTime Library
'Add reference to Crystal Reports Viewer Control
'Add reference to Microsoft ActiveX Data Objects 2.x Library
'oCnn = current open ADO connection object
Dim oApp As CRAXDRT.Application
Dim oReport As CRAXDRT.Report
Dim oRs As ADODB.Recordset
Dim sSQL As String
sSQL = "SELECT * FROM StaffDetails"
Set oRs = New ADODB.Recordset
Set oRs = db_conn.Execute(sSQL)
Set oApp = New CRAXDRT.Application
Set oReport = oApp.OpenReport(App.Path & "\MyReport.rpt")
oReport.Database.SetDataSource oRs, 3, 1
crvMyCRViewer.ReportSource = oReport
crvMyCRViewer.ViewReport
Dim StaffID As CRAXDRT.ParameterFieldDefinitions
Dim cpar As CRAXDRT.ParameterFieldDefinition
oReport.EnableParameterPrompting = False
oReport.ParameterFields.GetItemByName("StaffID").AddCurrentValue "combo1.text"
End Sub
but it is giving some error message Invalid name.
Edit: Added [vbcode][/vbcode] tags for more clarity. - Hack