>>One of the solutions is like this:
>>
>>1. create a program, say closeafterprint.prg:
>>IF wexist("Printing...") AND WEXIST("Print Preview")
>> RELEASE WINDOWS "Print Preview"
>>endif
>>2. add a field to your report, and with expression
>>closeafterprint()
>
>Than you.
>I did the following:
>
>in last group footer on exit expression added
>
>execscript("IF wexist('Printing...')"+chr(13)+"RELEASE WINDOWS 'Print Preview' "+ chr(13)+ "ENDIF")
>
>After printing from preview VFP9 SP2 crashes with exception
>
>Fatal error: Exception code=C0000005 @ 23.10.2008 11:17:12. Error log file: C:\myapp\algus\VFP9Rerr.log
> Called from - read_events line 0 { c:\myapp\algus\alguss.exe}
> Called from - alguss line 0 { c:\myapp\algus\alguss.exe}
>
>How to fix this ?
AFAIK execscript doesn't see the environment, in other words Execscript won't see any windows. I guess that's why it crashes. Create a prg or a function instead.