LOCAL lcRxCaption,lcPharmacy,lcPhone, llMarked, lcSetExact SET PRINTER TO Default *TMT Moved focus from grid to the txtDrugFilter object to avoid problems with the preview and print.... *In this case, if the grid has the focus, then the preview will show correctly, but not print anything.... Thisform.cntActions.txtDrugFilter.Enabled = .T. Thisform.cntActions.txtDrugFilter.SetFocus llMarked = .F. STORE SET('EXACT') TO lcSetExact SET EXACT OFF Thisform.mousepointer = 11 Thisform.m_Actions(2) ThisForm.txtStatus.value = "Printing Patient Medical Reports..." SELECT rx GO TOP * *Check to see IF we have any marked records..... DO WHILE NOT EOF('rx') IF marked = .T. llMarked = .T. EXIT ENDIF SKIP ENDDO IF llMarked *TMT Moved focus from grid to the txtDrugFilter object to avoid problems with the preview and print.... *In this case, if the grid has the focus, then the preview will show correctly, but not print anything.... Thisform.cntActions.txtDrugFilter.Enabled = .T. Thisform.cntActions.txtDrugFilter.Visible = .T. Thisform.cntActions.txtDrugFilter.SetFocus *TMT Save the Marked values to the table, so the SQL select can see these marked values. *We will reset them back to .F. later in the actual table. =TABLEUPDATE(.T.,.T.,'rx') *Now, select which SQL select to use, based on the index order... how we wish to see the data IF Thisform.p_OrderBy = 1 && filldate SELECT * FROM rx, drug, doctor ; WHERE rx.drug_id = drug.drug_id AND rx.doctor_id = doctor.doctor_id AND marked ; order BY filled_date DESC, rx_no DESC, refill_no DESC INTO CURSOR rxpmr ELSE && decendrx SELECT * FROM rx, drug, doctor ; WHERE rx.drug_id = drug.drug_id AND rx.doctor_id = doctor.doctor_id AND marked ; order BY rx_no DESC, refill_no DESC INTO CURSOR rxpmr ENDIF REPORT FORM RxPMR NOCONSOLE TO PRINTER PREVIEW USE IN rxpmr Thisform.cntActions.txtDrugFilter.Enabled = .F. Thisform.grdProfile.SetFocus ELSE MESSAGEBOX("There are no Rx's selected to print the Patient Medical Report" + CHR(13) + ; "(To select a Rx, check it)",64,"Cannot Print PMR(s)") ENDIF SELECT rx REPLACE ALL marked WITH .F. =TABLEUPDATE(.T.,.T.,'rx') *TMT Moved focus back to the grid to refresh the grid..... Thisform.cntActions.txtDrugFilter.Enabled = .F. Thisform.grdProfile.SetFocus Thisform.mousepointer = 0 ThisForm.txtStatus.value = "" IF Thisform.p_OrderBy = 1 SET ORDER TO filldate IN rx ELSE SET ORDER TO decendrx IN rx ENDIF SELECT rx SET KEY TO (STR(Thisform.p_patient_id)) IF Thisform.p_viewtype = 1 SELECT refill SET FILTER TO INLIST(status,0,1,4,5) && 4 Included so batch Rx's cant be refilled SET EXACT OFF lcFilter = IIF(NOT EMPTY(Thisform.p_buffer),; Thisform.p_previousdrugfilter + " AND UPPER(drug.name) = '" + ; ALLTRIM(UPPER(Thisform.p_buffer)) + "' IN Rx",; Thisform.p_previousdrugfilter + " IN Rx") SELECT Rx SET FILTER TO &lcFilter GO TOP IN rx ELSE SELECT refill SET FILTER TO SELECT rx SET EXACT OFF lcFilter = IIF(NOT EMPTY(Thisform.p_buffer),; "UPPER(drug.name) = '" + ; ALLTRIM(UPPER(Thisform.p_buffer)) + "' IN Rx","") SELECT Rx SET FILTER TO &lcFilter GO TOP IN rx ENDIF *Thisform.grdProfile.refresh() Thisform.m_UpdateStaticArea() Thisform.MousePointer = 0 SET EXACT &lcSetExact ThisForm.grdProfile.Refresh() Thisform.m_Actions(1)So, I had to resort to an SQL statement to get the data from the underlying tables what were "marked" (not until I saved the data with Tableupdate). This SQL statement fed the report. Then I cleared the "marked" records in the underlying table (leaving them "marked" on the grid when it was refreshed).