* code from form to launch report preview private lnMaxBuyerID lnMaxBuyerID = thisform.text1.value lcReportSource = "testReport" * this is the temporary file name the report is copied to...in practice you would * not want to create this file in the current folder...probably want to put it * in temporary file location lcTempReport = SUBSTR(SYS(2015), 3, 10) copy file (lcReportSource + ".fr?") to (lcTempReport + ".fr?") report form (juststem(lcTempReport)) preview nowaitIn the init() method of the report's dataenvironment, create a one record cursor to hold the report parameters (for printing on the report header, for example), and create a report cursor that contains that data that is printed in the body of the report. Interesting sidebar, in playing with this, I observed that opentables() and beforeopentables() methods fire on *every* page of a report...so neither of them are a good place to put this code. Here is a simplified example:
* init() method of report dataenvironment nodefault dodefault() if vartype(pnMaxBuyerID) <> "U" create cursor reportParameters (maxBuyerID i) insert into reportParameters (maxBuyerID) values (pnMaxBuyerID) select * from buyers where buyerID <= reportParameters.MaxBuyerID into cursor reportCursor select reportCursor endifI hope I didn't leave anything out. Let me know what you think...