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!

get total value from crystal report

Status
Not open for further replies.

VBmim

Programmer
Jun 25, 2001
361
BE
Hello

I am working with visual basic 6 and the rdc8 component of crystal report. I have in my report a total field I would like to extract the value of in a vb6 form. Is this possible?

I already tried report.SummaryFields(1).value but it returns empty (while the property name retrieves the name of the summary field all right).

Thnx in advance

Greetz

VBMim
 
You can create a Section variable WithEvents, and use its Format event to get the value, the caveat being you have to send the report to a viewer or printer in order for the event to fire.

I don't have CR 8, but this works with both 8.5 and 9, so it's quite possible this was available in the RDC in 8.0 as well.

1) Declare a Section object in the General Declarations section of your form:
Code:
Dim WithEvents crxSection As CRAXDRT.Section
2) Before previewing or printing the report, set the section variable = the section that contains your summary field
Code:
[green]'This would set the section variable = the Report Footer[/green]
Set crxSection = Report.Sections("RF")
3) Put the code in the crxSection_format event to extract the value of your summary field
Code:
Debug.Print Report.SummaryFields(1).Value

-dave
 
Hello Dave

Thanks for your response.
That was what I needed, thanks!

Greets

VBMim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top