views:

316

answers:

0

Hi

How Can I pass stored procedure parameter values from vb6.0 application to show a report (made by crystal reports 8.5) ?

any help will be appreciated

Below lines are what I have done but still have problem on showing the report:

Private Sub FeedReport()
    Dim mobjReport as New CrystalReport1
    Dim CRXParamDefs As CRAXDDRT.ParameterFieldDefinitions
    Dim CRXParamDef As CRAXDDRT.ParameterFieldDefinition

Set CRXParamDefs = mobjReport.ParameterFields
For Each CRXParamDef In CRXParamDefs
    With CRXParamDef
        .ClearCurrentValueAndRange
        Select Case .ParameterFieldName
            Case "@ProjectCreateDateFrom":
                .AddCurrentValue Me.msProjectCreateDateFrom

            Case "@ProjectCreateDateTo"
                .AddCurrentValue Me.msProjectCreateDateTo
        End Select
        .ClearCurrentValueAndRange
        Select Case .Name
            Case "{?@ProjectCreateDateFrom}":
                .AddCurrentValue Me.msProjectCreateDateFrom

            Case "{?@ProjectCreateDateTo}"
                .AddCurrentValue Me.msProjectCreateDateTo
        End Select
    End With
Next
DoEvents
With mobjReport
    .txtProjectCreateDateFrom.SetText Me.msProjectCreateDateFrom
    .txtProjectCreateDateTo.SetText Me.msProjectCreateDateTo
    .Database.Tables(1).SetLogOnInfo .Database.Tables(1).LogOnServerName,     .Database.Tables(1).LogOnDatabaseName, .Database.Tables(1).LogOnUserID, strPassword
    .DiscardSavedData
    .EnableParameterPrompting = False
    .ReadRecords
End With
CRViewer1.ReportSource = mobjReport
CRViewer1.ViewReport

End Sub '================================