Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to pass some values to crystal reports at run time

Status
Not open for further replies.

1forino

Programmer
Apr 26, 2001
14
PT
Hi,

I'm newer at Crystal Reports. I have an application in VB6,
and I need to show some fields (inputs from the user, not fields from a database) in a report I create.
How can I do this?
Thanks for any tip.
 
Or create empty formulas in the report, and pass literal values to the formulas from your app. Ken Hamady
Crystal Reports Training/Consulting and a
Quick Reference Guide to VB/Crystal (including ADO)
 
Thanks for the tips.

I have tried with formula fields, but I always get this error "Type mismatch". What is wrong with that piece of code?

I create a formula in the report with the name of "Para", and in VB 6 I Write this:

Dim strName As String

strName="Jonh"

CrystalReport.FormulaFields("Para").Text = strName
 
The value that goes to CR has to be a valid string formula, which means that you have to pass quotes. What you are passing won't have quotes once it get's to CR. Try

strName="'Jonh'" Ken Hamady
Crystal Reports Training/Consulting and a
Quick Reference Guide to VB/Crystal (including ADO)
 
Thanks for the tip, but also already had attemped this and continues to get the same error...

"Tipe mismatch"

Exists another way to pass parameters in run time to a crystal report?
 
That is because you are using the syntax for the Automation Server (an older technique). But it appears form this error that your application uses the newer, "RDC". Try the following syntax:

Dim strName As String
strName = "'Jonh'"
report.FormulaFields(3).Text = strName

The number has to identify the position of this formula in the report's list of formulas. You can't use the formula name when using the RDC. Be careful, because adding formulas can change the number in the list. Ken Hamady
Crystal Reports Training/Consulting and a
Quick Reference Guide to VB/Crystal (including ADO)
 
The last tip resulted:)
Thanks one more time for the aid.
He was difficult to arrive there...:)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top