>>>>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
[snip]
>Elyse, go into your report DE properties and set AutoOpenTables and AutoCloseTables to .F. This should keep the report from trying to open the view again.
>
>Then, you might try putting your 'Select MyView' into a loop -
>
>lCount = 0
>Do While select(MyView) = 0 .and. lCount < 10
> SELECT MyView
> lCount = lCount+1
>ENDDO
>
>if lcount =10
> **Error message
>else
> REPORT FORM...
>endif
>
>It still sounds to me as if there's a conflict somewhere with your report's internal setup. This might tell you if re-selecting would help in some way. Hope one of these ideas helps.
>
>Barbara
Re-selecting doesn't seem to help. I did notice something strange, though. I watched the DataSession window while the code was being executed and when MyView was selected, I saw the cursor flash to the view and then back to the other table. I don't know why. Does it have anything to do with the fact that the view is based on this other table?
Elyse
Elyse Pomerantz