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

Crystal V9 Report Record Selections 1

Status
Not open for further replies.

kennedymr2

Programmer
May 23, 2001
594
AU
I am using Crystal V9 and Visual Basic v6 Sp5

I have developed a report Report1.rpt and the report in itself works fine.

I need to run the report from VB6 , and make a selection ie
{db1.client} >= cfrom and {db1.client} <= cto
Ie i need to tell the crystal report to use these selections to limit the records printing.
I have a form (Form1) with the crystal viewer CrystalViewer91 on it.

I have imported the report1.rpt into the vb6 project and it end up in designer crystalreport1.

Would appreciate the code or method in achieving this.
Mainly in how to pass the selection critea.

Most of the help i can find is for V8, V9 looks a little different.
 
If you're using the RDC (CRAXDRT.DLL) it's the same as 8. Here's an example, assuming cfrom and cto are strings and crRpt is your report object:

crRpt.RecordSelectionFormula = &quot;{db1.client} >= &quot; & Chr(34) & cfrom & Chr(34) & &quot; {db1.client} <= &quot; & chr(34) & cto & chr(34)

Make sure your syntax is exactly as it would appear if you were entering the Record Selection within Crystal itself. I've used Chr(34) for the double quotes, but you can use the more common:

crRpt.RecordSelectionFormula = &quot;{db1.client} >= &quot;&quot;&quot; & cfrom & &quot;&quot;&quot;&quot; & &quot; {db1.client} <= &quot;&quot;&quot; cto & &quot;&quot;&quot;&quot;


If cfrom and cto are not strings, just don't enclose them in quotes.
 
Appreciate the help.
At the moment i am trying to get away with only using the viewer.
Will have a go using the .dll object, as per your sujjestion.

Is it possible to pass selections via the viewer.
 
To my understanding, the viewer doesn't generate the report pages; it only receives them. You have to use the RDC--that is, CRAXDRT (or CRAXDDRT)--to generate the report. The viewer has a ReportSource property that requires a CRAXDRT.Report object. So without the RDC, your viewer has nothing to show. As for the record selection, if you look at the object model in the Developers help file for the viewer, you won't find anything related to record selection. You have to change that in the RDC's report object.

I would recommend downloading the following from the Crystal KB to familiarize yourself with the RDC:

 
Thanks for you explanation of the problem
Much appreciated.
The link you gave me includes a lot of examples not included with crystal9 program cd. The extra examples cover most of my problems.

regards
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top