Results 1 to 1 of 1

Thread: how to show tha vb combo values in report

  1. #1

    Thread Starter
    Hyperactive Member wizkid's Avatar
    Join Date
    Dec 2005
    Location
    uk
    Posts
    405

    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:
    1. Private Sub ViewReport_Click()
    2. 'Add reference to Crystal Reports x.x ActiveX Designer RunTime Library
    3. 'Add reference to Crystal Reports Viewer Control
    4. 'Add reference to Microsoft ActiveX Data Objects 2.x Library
    5. 'oCnn = current open ADO connection object
    6.  
    7. Dim oApp As CRAXDRT.Application
    8. Dim oReport As CRAXDRT.Report
    9. Dim oRs As ADODB.Recordset
    10. Dim sSQL As String
    11.  
    12. sSQL = "SELECT * FROM StaffDetails"
    13. Set oRs = New ADODB.Recordset
    14. Set oRs = db_conn.Execute(sSQL)
    15. Set oApp = New CRAXDRT.Application
    16. Set oReport = oApp.OpenReport(App.Path & "\MyReport.rpt")
    17. oReport.Database.SetDataSource oRs, 3, 1
    18. crvMyCRViewer.ReportSource = oReport
    19. crvMyCRViewer.ViewReport
    20.  
    21. Dim StaffID As CRAXDRT.ParameterFieldDefinitions
    22. Dim cpar As CRAXDRT.ParameterFieldDefinition
    23. oReport.EnableParameterPrompting = False
    24.  
    25. oReport.ParameterFields.GetItemByName("StaffID").AddCurrentValue "combo1.text"
    26. End Sub
    but it is giving some error message Invalid name.




    Edit: Added [vbcode][/vbcode] tags for more clarity. - Hack
    Last edited by Hack; Jan 30th, 2006 at 08:07 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width