Scott,
You are correct with your assumption concerning NOWAIT.
With NOWAIT, the OpenTables EventMethod of the report's DataEnvironment fires each time the report redraws (e.g. Zoom). This makes sense because of the fact that with the NOWAIT option, program execution continues after the REPORT FORM
blah, blah, blah NOWAIT PREVIEW command.
I use the following solution when using NOWAIT:
[1] In the report designer, set it to use a Private Data Session.
[2] Put the following code in the OpenTables EventMethod of the report's DataEnvironment:
LOCAL loActiveForm, lcCursor
loActiveForm =
whateverlcCursor =
whateverSET DATASESSION TO (loActiveForm.DataSessionID)
GOTO
startpoint IN (lcCursor)
Make sure that loActiveForm is referencing the correct form object and not a toolbar - in other words, be careful using _SCREEN.ActiveForm. Also, the record pointer must be repositioned every time the report redraws - even if you are zooming the last page of a 1,000 page report.
One real cool benefit to this approach is that you can minimize the report preview, do a requery in loActiveForm, restore the report preview and see a new report (after a redraw, zoom, etc.) without ever closing the preview.
Hope this helps.
JP
>Marty...
>
> I've tried that, setting the datasession to be the same as the form which called it. I *still* get the same problem. The issue seems to be my use of NOWAIT with the REPORT FORM MyReport PREVIEW: after the report has run, the datasession is somehow being set to the default, instead of the datasession it had when it ran originally.
>
> I've tried setting the datasession in *every* method that gets called before the report redraws, and it *still* loses the reference. It's something in the guts of the reporting tool itself.
>
>Scott
>
>>Are you sure you want the preview form to have a private datasession? Wouldn't you rather set it to 1-Default and allow it to use the datasession that called it?
- Jeff