Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Why I can't pass parameters into CR from VB6 Post Reply Post New Topic
Author Message
Dean
Newbie
Newbie
Avatar

Joined: 01 Jun 2010
Location: Taiwan
Online Status: Offline
Posts: 14
Quote Dean Replybullet Topic: Why I can't pass parameters into CR from VB6
     Posted: 21 Jun 2010 at 8:44pm


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} in ["USA","usa"] then
      "This is test 1 sentences"
   else if
{?@cmpy} in ["TWD","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 Dean - 21 Jun 2010 at 8:53pm
Have a Nice Day!!
Best Regards.

Questions and Answers seem like same. All in your mind.

Larry Lai
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 22 Jun 2010 at 3:16am
don't you need to set the parameter field in code to the parameter field in the report...isn't there a way to associate them?
IP IP Logged
Dean
Newbie
Newbie
Avatar

Joined: 01 Jun 2010
Location: Taiwan
Online Status: Offline
Posts: 14
Quote Dean Replybullet Posted: 22 Jun 2010 at 5:06am
Originally posted by lockwelle

don't you need to set the parameter field in code to the parameter field in the report...isn't there a way to associate them?


Thx lockwelle 

Do you mean set the default value of these parameters in report??

I had done that, I set the default value in these two parameters, and there wasn't parameter field in vb code, when i opened crystal report, it also show "This field name is not known"

Because my report put these two Formula(used these two parameters) in detail's section, So i had to pass value into report from vb.


Edited by Dean - 22 Jun 2010 at 5:22am
Have a Nice Day!!
Best Regards.

Questions and Answers seem like same. All in your mind.

Larry Lai
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 22 Jun 2010 at 10:08am
No, I was thinking that should be a way to associate the 2 parameters that you are creating in code to the parameters in the report... I thought that you somehow told the code which parameter in the report it belongs to. 
 
It has been a while since I create my own parameter wizard and just pass the resulting dataset to the report.
 
HTH
IP IP Logged
Dean
Newbie
Newbie
Avatar

Joined: 01 Jun 2010
Location: Taiwan
Online Status: Offline
Posts: 14
Quote Dean Replybullet Posted: 22 Jun 2010 at 3:48pm
Originally posted by lockwelle

No, I was thinking that should be a way to associate the 2 parameters that you are creating in code to the parameters in the report... I thought that you somehow told the code which parameter in the report it belongs to. 
 
It has been a while since I create my own parameter wizard and just pass the resulting dataset to the report.
 
HTH
 
So you mean you can actually pass parameters into report from code.
How do you pass them?? Is same as I write(.AddCurrentValue )??
I don't know why I couldn't success??
 
This Code is old from an older generation(senior), I only do is copy his function into my.
So I wonder why it could run well before, but I can't.Confused
 
Really Thanks


Edited by Dean - 22 Jun 2010 at 3:50pm
Have a Nice Day!!
Best Regards.

Questions and Answers seem like same. All in your mind.

Larry Lai
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum