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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Visual Basic Crystal Reports

Status
Not open for further replies.

yns

Programmer
Feb 15, 2006
6
GB
I am opening a crystal report in Visual basic and I want to reference a formula in the crystal report from the visual basic. I also want to be able to reference a field in the crystal report, from the visual basic project.
Pls advise if anyone can help or if this is better off in the Crystal Reports forum
 
To see formula fields
Code:
Dim rdApp As CRAXDRT.Application
Dim rpt   As CRAXDRT.Report
Dim fla   As CRAXDRT.FormulaFieldDefinition

Set rdApp = CreateObject("CrystalRuntime.Application")
Set rpt   = rdApp.OpenReport("C:\myReports\TheReport.rpt")
[COLOR=black cyan]' Set the value for the 'Filter' field.[/color]
For Each fla In rpt.FormulaFields
   If fla.Name = "Filter1" Then
      fla.Text = "'" & myFilter & "'"
      Exit For
   End If
Next fla
I don't know of a way to reference a specific field but you could assign the field's value to a Formula field. My version of Crystal is somewhat behind the times (8.5) so there may be more functionality in later releases.
 
Many thanks for your help. My colleague has overcome this problem.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top