views:

412

answers:

2

hi How to feeding Crystal Report 8.5 parameters from VB6.0 Application?

+1  A: 

Here is one way of doing it (assuming that crxRpt points to a valid report object):

Dim crxParam as CRAXDRT.ParameterField
For Each crxParam In crxRpt.ParameterFields
    Select Case crxParam.Name
        Case "{?MyStringParam1}"
            crxParam.AddCurrentValue "Parameter1 value"
        Case "{?MyNumberParam2}"
            crxParam.AddCurrentValue 25.35
    End Select
Next crxParam
Heather
Heather,Thank you but I still have some problem while executing my report. let's explain it :I have made a new report using Crystal Reports 8.5 (report1) which uses a stored procedure for its data source.The stored procedure has 2 input parameters (@p1 and @p2) and when I enter some test data for @p1 and @p2, every thing is all right.Then, I added the report1 in visual basic 6.0 IDE and added a new form (form1) and a crystal report viewer control on form1.Now please help me: I wanna to show the report1.What codes exactly should I use ?
odiseh
A: 

Use the GetItemByName(ByVal Name As String, Optional ByVal SubreportName As Object = Nothing) As CRAXDDRT.ParameterFieldDefinition method. Once you have the ParameterFieldDefinition object, the world is your oyster.

Craig