I removed the extra "TO" and changed the path as suggested. While it did create the temporary pdf in a more appropriate location (USERS\APPDATA\LOCAL\TEMP), the lnResult was still -121 instead of zero.
Unfortunately, the PDF that it did create was a bit malformed - it didn't have the footer nor the company logo. This is very unusual.
>>Below is some code we have used without problem for years through Win7. It creates a PDF using eReports, saves it to a temporary file and, if successful (if lnResult=0), creates the Outlook email.
>>
>>Suddenly, on Win10 boxes, it is returning lnResult="-121"
>>
>>I can't figure out what the error means - any ideas? Thanks!
>>
>>****UPDATE - the perplexing part is that the PDF is actually created and in the temp folder, yet the value of lnResult is not zero****
>>
>>
>>
>>CASE nBarNum=7
>> l_coldpath=SYS(5)+SYS(2003)
>> SET PATH TO c:\qdms2004
>> LOCAL lnResult, oPDF
>> p_recnum=STR(RECNO("cofc"))
>> l_attachment='c:\windows\temp\qdms\cert.pdf'
>> l_stdtext="Attached is Certificate of Compliance No. ";
>> +THISFORM.Qdmsbasepgf1.Page1.txtCertnum.VALUE +" for ";
>> +ALLTRIM(THISFORM.Qdmsbasepgf1.Page1.txtMatl.VALUE);
>> +" as you requested."+CHR(13)+" "+CHR(13);
>> +"If you have any further questions, please contact XXXXXXX"
>>
>> oPDF = NEWOBJECT ("eReportsPDF", "eReports.dll", "eReports.dll")
>> oPDF.UNLOCK("xxxxxxx xxxxxx - XXXXXXX XXXXXX XXXXX XXXXX")
>> oPDF.EmbedFonts = 0
>> oPDF.JPGQUality=5
>> oPDF.ReportFile = "qcf75.frx"
>> oPDF.OutPutFile = "C:\Windows\Temp\qdms\Cert.Pdf"
>> oPDF.ReportExpr = "RECORD "+p_recnum
>> lnResult = oPDF.ReportConvert()
>> SET PATH TO TO l_coldpath
>>
>> *If the PDF was created, prepare the email in Notes
>> IF lnResult=0
>>
>>
>
>What happens if you change the line:
>
oPDF.OutPutFile = "C:\Windows\Temp\qdms\Cert.Pdf"
>to something like:
>
oPDF.OutPutFile = ADDBS(SYS(2023))+"Cert.Pdf"
Phil Thomas
http://phillipdthomas.comNever let your energy or enthusiasm be dampened by the discouragements that must inevitably come.....