Edit Formula field in Crystal Report using VB

I have Crystal Report 8.5, VB6. I have this Crystal report with a simple formula, which does.

stringVar str := "";
{CrystalLoss.Category}=str;

The value for str should come from the VB form.
Once I get the user input, how can I pass the value of str to Crystal using VB.

I saw many places, CrystalReport1.Formulas(0) = blah blah..

Thanks,
-G
girishsarmaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

frodomanCommented:
The best approach is to create a parameter on your report and then use the parameter in your formula:

{CrystalLoss.Category} = {?YourParameter};

Here's a working example of how to pass a parameter so you can just copy & paste the code into your application: http://support.businessobjects.com/communityCS/FilesAndUpdates/cr8_vb_rdc_parameter.exe.asp

HTH

frodoman
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
vidruCommented:
Looks like you're using the OCX(?).

Are you trying to change the Record Selection Formula at runtime, or just a regular formula field?

To replace the Record Selection Formula:
CrystalReport1.ReplaceSelectionFormula ("{CrystalLoss.Category} = '" & str & "'")

Or, as frodoman suggested, if you create a parameter in the report, you'd pass it like:
CrystalReport1..ParameterFields(1) = "ParamName;" & str & ";true"

-dave
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Crystal Reports

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.