Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to call RR from VFP
Message
General information
Forum:
Visual FoxPro
Category:
Third party products
Miscellaneous
Thread ID:
00252875
Message ID:
00253388
Views:
22
Peter,

This is probably more than you need, but I thought I would go ahead and give you most everything you need to call R&R from VFP. You will have to initialize the variables that are used in this code, but should be a jump start. R&R is one of the best report writers for xBase out there. However, I have recently switched to using Crystal's automation server due to the apparent future of R&R, which doesn't look good.

Hope this helps!

James

*****************************

ThisForm.AddObject('oRRControl','OLEControl','R&R.ReportControl')

IF llError OR TYPE('ThisForm.oRRControl') # 'O'
= MESSAGEBOX('Error creating the report control object!',16,'Report Error')
llError = .T.
ELSE
WITH ThisForm
.oRRControl.DataDirectory = lcTablePath
.oRRControl.DisplayError = .F.
.oRRControl.DisplayStatus = .T.
.oRRControl.StartPage = 1
.oRRControl.EndPage = 9999
.oRRControl.CopiesToPrinter = 1
.oRRControl.ExportDestination = 2
.oRRControl.IndexExtension = 1
.oRRControl.NoEscape = .F.
.oRRControl.ReportDirectory = lcReportPath
.oRRControl.ReportPick = 0
.oRRControl.WriteAllow = .T.
.oRRControl.ReportName = lcReportFile
.oRRControl.WindowTitle = ALLTRIM(lcReportTitle)
.oRRControl.Filter = ALLTRIM(lcFiltExpr)
.oRRControl.Query = 2

* Determine if the user is prompted for a printer.
IF .lPrinterPrompt
.oRRControl.Printer = '?'
ELSE
.oRRControl.Printer = SET('Printer',2) && Default Printer
ENDIF

* Set up report parameters
.oRRControl.Parameters(0)='rtitle=' + lcTitle
.oRRControl.Parameters(1)='rsubtitle=' + lcSubTitle

* Values available for the oRRControl.Destination property.
*
* 0 - Saved (uses the printer saved with the report)
* 1 - Window (sends the report to a preview window)
* 2 - Printer (sends the report to a printer)
* 3 - Text File (exports the report to an ASCII text file)
* 4 - DBF File (exports the report to a DBF database file)
* 5 - WKS File (exports the report to a WKS spreadsheet file)
* 6 - Prompt user (asks user for destination)
* 7 - RTF File (exports to a Rich Text Format file)
* 8 - Text Data File (exports to a Text Data file)
* 9 - Word Merge file (exports to a Word Merge file)
* 10 - Excel Chart
* 11 - Excel PivotTable

DO CASE
CASE lnDest = 1
.oRRControl.Destination = 1
CASE lnDest = 2
.oRRControl.Destination = 2
CASE lnDest = 3
.oRRControl.Destination = lnExportType
OTHERWISE
ENDCASE

_VFP.AutoYield = .F.

* Run the report.
.oRRControl.Action = 1

_VFP.AutoYield = .T.
ENDWITH
ENDIF
James Moore
Owner/Developer
Ministry Tracking Software, Inc.
www.youthtrack.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform