>I have a grid on my form that is based on a view and I want to print a simple report of what shows in the grid. I used the Report Wizard to design a report from this view. The report contains ONLY fields from this view. In my Print button on my form, I simply say:
>
>select MyView
>report form PrintView to print noconsole
>
>For some unknown reason, the report is trying to print from another table! If I suspend after the 'select MyView' command I see that MyView is NOT actually selected, but I can't figure out why.
>
>More details:
>1) It doesn't matter whether or not the fields in the report have an alias.
>2) It doesn't matter whether or not MyView is in the DataEnvironment of the report.
>3) If I step through the code from before the 'select', it works fine.
>4) If I 'Browse' instead of 'Report form...', it is on the right file.
>5) The STRANGEST - if I say 'preview' instead of 'to print', it previews fine!
>
>I've tried everything I can think of to no avail. This is happening in more than one form with different sets of files/views. Any help would be GREATLY appreciated!
>
>Thanks
>Elyse
Elyse, try setting the DataSession of the Report to Private. This will force it to look to its own DataEnvironment where you've called the view.
An alternative, is to set the DataSession to default, remove the view from the data environment (this won't affect fields on the report) and make sure the view is requeried and active (Selected) before you run the report.
HTH
Barbara