Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


Edit Formula field in Crystal Report using VB

Posted on 2004-10-22
Medium Priority
Last Modified: 2008-02-01
I have Crystal Report 8.5, VB6. I have this Crystal report with a simple formula, which does.

stringVar 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..

Question by:girishsarma
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 42

Accepted Solution

frodoman earned 500 total points
ID: 12381118
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


LVL 13

Expert Comment

ID: 12381467
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"


Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question