Skip to Content
avatar image
Former Member

Why I can't pass parameters into CR from VB6

I want to Pass parameters into crystal report from VB6.

But whatever I try, it don't work Fine,

always Show the message "This field name is not known".

Crystal Report::

Parameter: a.@cmpy;

b.@p1

formula:

a. If {?@cmpy} ="USA" or {?@cmpy} ="usa" then

"This is test 1 sentences"

else if {?@cmpy}="TWD" or {?@cmpy} = "twd" then

"This is test 2 sentences"

b. if trim({?@p1})="1" then "This is test 3 sentences"

VB::

Public oApp As New CRAXDDRT.Application

Public oRpt As CRAXDDRT.Report

...

oRpt.ParameterFields(1).ClearCurrentValueAndRange

oRpt.ParameterFields(2).ClearCurrentValueAndRange

oRpt.ParameterFields(1).AddCurrentValue ("TWD")

oRpt.ParameterFields(2).AddCurrentValue ("1")

...

I had trid to use "IsCurrentValueSet" function to check whether parameter was set or not, and It responsed "Ture",so I so confused about it.

Anyone know about this??

ps. I had trid other way that change the formula indirectly, although it can work fine, but it isn't a right way to solve my problem.

Edited by: DeanLai on Jun 22, 2010 8:54 AM

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Jun 22, 2010 at 02:12 PM

    Moved to Legacy SDK forum

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      I Find something.

      First I tried to add parameter and wanted to see these value on Report.

      So I inserted {?@cmpy} and {?@p1} into report, and used VB code

      "oRpt.ParameterFields(1).AddCurrentValue ("TWD")" and "oRpt.ParameterFields(2).AddCurrentValue ("1")",

      then ran the process, but it didn't display any value on report,

      so why it couldn't pass value into parameter??

      then I tried other way which was to add new parameter, and used the same way to pass

      value into parameter, then it can display value on report.

      So the different between these is {?@cmpy} and {?@p1} which come from

      Stores Procedure.

      While I set Database in crystal report, set all value into Store Procedure's

      parameter(the window about "Enter Parameter Values"), then it automatic come out the DB columns and parameter(SP parameter)

      , course include {?@cmpy} and {?@p1}.

      Do this problem cause my question?

      Can we pass value into parameter which come from SP parameter??

      Can we use these parameter into forumla??

      Edited by: DeanLai on Jun 30, 2010 11:56 AM