• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 542
  • Last Modified:

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
0
girishsarma
Asked:
girishsarma
1 Solution
 
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
 
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

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now