zerobro
asked on
Editing SQL query statement in subreport
Hi Experts,
In crystal 8 or 8.5, is there a way to edit the subreport's query at runtime?
If this can be done, please show me a VB or Delphi code on how to do this.
TIA,
zerobro
In crystal 8 or 8.5, is there a way to edit the subreport's query at runtime?
If this can be done, please show me a VB or Delphi code on how to do this.
TIA,
zerobro
ASKER
Hi mlmcc,
You mean with CRReport.ReplaceSelectionF ormula property, I can edit the subreport's SQL query? The "SELECT....FROM" statement? This is the one I need to edit. I need to modify the FROM area of the subreport's query.
zerobro
You mean with CRReport.ReplaceSelectionF
zerobro
The ReplaceSelectionFormula doesn't really edit the query but rather replaces it when the VB program issues the CRReport.Action = 1 and runs the report. I do this all the time with the report's query with no problem I looked at the options VB provided for the CR object and saw you could designate which subreport to change.
Hope this helps. If you want a complete example let me know and I'll add it at work tomorrow.
good luck
mlmcc
Hope this helps. If you want a complete example let me know and I'll add it at work tomorrow.
good luck
mlmcc
ASKER
Hi mlmcc,
Yes please...
Please show me an sample code lines on how to do this.
Thanks,
zerobro
Yes please...
Please show me an sample code lines on how to do this.
Thanks,
zerobro
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi mimcc...your solution more or less solved my problem...thanks...
the VB Crystal OCX Object has a property called SubReportToChange.
CRReport.SubReportToChange
CRReport.ReplaceSelectionF
If you need more than this I can provide it but it is on a different machine without internet access.
good luck
mlmcc