View Single Post
  #1 (permalink)  
Old December 23rd, 2009, 03:36 AM
Jun Fuderanan Jun Fuderanan is offline
Registered User
Join Date: Dec 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Passing Parameters to Crystal Reports 8.5 using VB6

I used parameter fields in my crystal report and was able to pass parameters to it from my Visual Basic program. But the problem is the dialog box that keeps appearing asking me to enter the parameters. The discrete values have the same values as the parameters being passed. I do not want to enter the values again. How do I remove the dialog box?

My code:

Dim CRApp As New CRAXDRT.Application
Dim CRReport As New CRAXDRT.Report   'crystal report object
Dim CrtParameters As CRAXDRT.ParameterFieldDefinitions
Dim sRPTFile As String
Dim simula As String
Dim tapos As String
sRPTFile = App.Path & "\01653.rpt"
Set CRReport = CRApp.OpenReport(sRPTFile)

    simula = Format(DTPicker1.Value, "YYYY/MM/DD")
    tapos = Format(DTPicker2.Value, "YYYY/MM/DD")
    With CRReport
        .Database.Tables.Item(1).SetLogOnInfo odbcname, odbcname,sysuserid, syspassword
        Set CrtParameters = CRReport.ParameterFields
        .ParameterFields.GetItemByName("@begdate").AddDefaultValue simula
        .ParameterFields.GetItemByName("@enddate").AddDefaultValue tapos
    End With

    'Show Report
    CRViewer1.ReportSource = CRReport
    CRViewer1.EnableExportButton = True
    CRViewer1.DisplayGroupTree = False
    CRViewer1.EnableDrillDown = True
    CRViewer1.EnableDrillDown = False
    CRViewer1.EnableCloseButton = True
    CRViewer1.Zoom (100)
    CRViewer1.Visible = True
    CRViewer1.ZOrder 0
Thanks in advance for helping.
Reply With Quote