cancel
Showing results for 
Search instead for 
Did you mean: 

Why I can't pass parameters into CR from VB6

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Moved to Legacy SDK forum

Former Member
0 Kudos

ok, I am sorry, I don't know about what forums should this question put in , and Thx for helping...

Edited by: DeanLai on Jun 22, 2010 4:37 PM

former_member183750
Active Contributor
0 Kudos

1) Do not use craxDDrt.dll, use craxDrt.dll. There are licensing implications to craxDDrt.dll and unless you are aware of these using craxdrt.dll will be better.

2) Make sure you have the latest updates for your version of CR - which you do not mention...

Updates and other downloads can be found [here|http://service.sap.com/sap/bc/bsp/spn/bobj_download/main.htm]

Ludek

Follow us on Twitter http://twitter.com/SAPCRNetSup

Former Member
0 Kudos

Thx Ludek Uher

I tried first item this morning, It also show message "This field name is not known".

I will Try second item later..

(what package is more important to update??)

former_member183750
Active Contributor
0 Kudos

They both get updated with the one patch.

Ludek

Former Member
0 Kudos

I had tried two patch "cr10win_en_sp6" and "Crystal 10 Database and Export Drivers MHF (En)", then tried again to pass in Parameter from VB.

It Also showed the message:"This field name is not known"

what Patch should I Update??

Thx a lot.

Former Member
0 Kudos

Do SubReport affect it?

Because My report has six Subreport in it, But only main report has tese formula that use {?@cmpy} and {?@p1},

so it should not affect it. Because if i deleted these formula which in main report, it can work.

former_member183750
Active Contributor
0 Kudos

Should not, but from what you say it does. So, try adding the subreports back in - one at a time to find out which one causes the issue.

Ludek

Former Member
0 Kudos

I really thanks your time.

I had tried to remove all subReport except the mainreport,

But It also show "This field name is not known".

Now, I have two methods that can run well.

one is remove these two forumla,

two is change the vb code

from

oRpt.ParameterFields(3).AddCurrentValue ("UMC")

to

oRpt.FormulaFields.GetItemByName("a").Text= "This is test 1 sentences"

That is to say, If I want the process success, I have to drop the forumla which is

relation with Parameter.How strange!!

Do I miss something??

Former Member
0 Kudos

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

Answers (0)