Thanks Sergey. Here it is.
LOCAL lcfile
lcfile = m.pcfile
if vartype(lcfile) <> "C" OR empty(ALLTRIM(lcfile))
messagebox("No parameters passed to printpdf.", 0+16+0,"Error")
return .f.
endif
DECLARE INTEGER ShellExecute ;
IN SHELL32.DLL ;
INTEGER nWinHandle,;
STRING cOperation,;
STRING cFileName,;
STRING cParameters,;
STRING cDirectory,;
INTEGER nShowWindow
* Print.
ShellExecute(0, "Print", lcfile, "", "", 0)
return .t.
>Can you post code for PrintPDF() method?
>
>>
>>I just put the code in to check if STRTOFILE returns successfully. It does, every time.
>>
>> I filled three reports and printed them. The first one printed, it skipped the second one, and printed the third one twice. Do you see anything else in my code that could be causing this?
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>>You should check if operation completed successfully
>>>
>>>lnBytesWritten = STRTOFILE(lcstring, trim(goapp.cpathshared) + "w2\" + ALLTRIM(lcyear) + '\8655out.xfdf', 0)
>>>
>>>IF lnBytesWritten = 0
>>> * Cannot write to the file
>>> * Do whatever
>>> ...
>>>ENDIF
>>>
>>>
>>>
>>>>No. Here's the code.
>>>>
>>>>* Update the xfdf file.
>>>>lccurdir = CURDIR()
>>>>CD trim(goapp.cpathshared) + "w2\" + ALLTRIM(lcyear)
>>>>DELETE file '8655out.xfdf'
>>>>CD &lccurdir
>>>>
>>>>STRTOFILE(lcstring, trim(goapp.cpathshared) + "w2\" + ALLTRIM(lcyear) + '\8655out.xfdf', 0)
>>>>
>>>>lcxfdf = trim(goapp.cpathshared) + "w2\" + ALLTRIM(lcyear) + '\8655out.xfdf'
>>>>
>>>>* Print the populated form.
>>>>SET CONSOLE OFF
>>>>SET HEADINGS OFF
>>>>
>>>>thisform.printpdf(lcxfdf)
>>>>
>>>>* Wait 10 seconds.
>>>> WAIT 'Printing the 8655 form...' window timeout 10
>>>> WAIT CLEAR
>>>>
>>>>SET HEADINGS ON
>>>>SET CONSOLE ON
>>>>
>>>>
>>>>>When you write back to the .xfdf file, do you check if operation completed successfully or failed?
>>>>>