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

How to override field value in Crystal Report XI

I am using Crystal Report XI release 2 with vs2005, with an Oracle back end db.  During run time, I may need to override a field value on the report.  So, the report returns a value from the database of "green", but at run time, I need to change the value to "blue."  I would like to do this via vb code.  Thank you.
0
KMBrochu
Asked:
KMBrochu
  • 3
  • 3
1 Solution
 
mlmccCommented:
In the report add a formula

If ({YourField} = 'green') then
    'blue'
else
    {YourField}

Use that instead of the field on the report.

mlmcc
0
 
KMBrochuAuthor Commented:
Thank you for your quick response.  I cannot do this on the report via formula, because the conditions completly change during run time...so I have to do it in VB.  
0
 
mlmccCommented:
You can't do it from VB except by changing the data in the database or passing a modified dataset to the report from VB.

mlmcc
0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

 
KMBrochuAuthor Commented:
I think your second option may work for me.  The report is originally set up with an ODBC connection to a table, but at run time, the selection criteria can change dramatically.  So the table stays the same, but the select portion will change.  Would you be able to provide an example of how to change the selection in VB?  Thank you again.
0
 
mlmccCommented:
If all you are changing is the selection formula you could use parameters or code like

crRpt.RecordSelectionFormula = "Add the where clause"

mlmcc
0
 
KMBrochuAuthor Commented:
Thank you!
0
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.

Join & Write a Comment

Featured Post

Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

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