Solved

Edit Formula field in Crystal Report using VB

Posted on 2004-10-22
531 Views
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 := "";
{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
Question by:girishsarma
    2 Comments
     
    LVL 42

    Accepted Solution

    by:
    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
     
    LVL 13

    Expert Comment

    by:vidru
    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

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
    Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
    With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…
    This video is in connection to the article "The case of a missing mobile phone (https://www.experts-exchange.com/articles/28474/The-Case-of-a-Missing-Mobile-Phone.html)". It will help one to understand clearly the steps to track a lost android phone.

    934 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

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now