Hi Thomas,
I had a similar problem: in my case, the preview was always OK but when the user printed from the preview window the cursor somehow got changed and the report printed incorrectly. The weird thing was that this only happened if there was only one page in the report. If there was more than one page then it printed correctly.
The report was being called from a form's PrintInvoice() method, via a popup menu activated by a right-click on the desired grid row. The grid displays a child table in the form. Somehow the cursor was reverting back to the form's parent table. I never did determine exactly what was causing this, but by debugging I found that the selected work area changed when the "Print" button on the Report Preview toolbar was clicked, or if the Zoom was used.
I circumvented the problem by doing a SetFocus() to a control on the form before calling the print method. Which control I set focus to didn't seem to matter. So the code in the form's PrintInvoice() method now looks like this:
with thisform
.cmdPrint.SetFocus()
oTrip.PrintInvoices( tripdetl.cTripNbr, tripdetl.cCustNbr)
.grdTrips.SetFocus()
endwith
This was one of my earliest VFP apps (VFP 5.0a, BTW) so I figured I had done something dumb in the design of the form. Anyway, hope this helps.
>We have a report within our program that when sent directly to the printer it works great. But when sent to directly to preview, it selects a differnet work area (somehow changes the selected cursor) it was pointing to and prints the wrong information. Oddly enough, if sent to the printer, then sent to preview it runs correctly both times. IHow can the cursor change during the preview?
Rick Borup, MCSD
recursion (rE-kur'-shun) n.
see recursion.