Sergey,
Using your code (with unique temp file name) works. That is, now I don't get error 111. Now after I followed Cathy Pountney's suggestion with headers, her approach works too. Last night I had two approached that didn't work and now I have two that work <g>.
Thank you so much for your help.
>Hi Dmitry,
>
>I don't see anything in your code that may cause such problem. Can you try slightly modified version of your code below?
cReportName = "myreportname.frx"
>cTempRepName = FORCEPATH(SYS(2015) + ".frx", SYS(2023))
>USE (cReportName) in 0 alias OrigReport
>select OrigReport
>COPY TO ( cTempRepName )
>USE in OrigReport
>USE ( cTempRepName ) in 0 alias TMPREPORT
>select TMPREPORT
>goto 3
>replace pagebreak with .F.
>...
>USE
>...
>REPORT FORM (cTempRepName) ...
>ERASE (cTempRepName)
>ERASE (FORCEEXT(cTempRepName, "FPT"))
On unrelated note, using absolute position of the record in FRX (GOTO 3) may cause problem in a future because modifying report may change it.
>
>>It is a definitely a different name.
>>
>>Here is the code:
>>
>>
>>cReportName = "myreportname.frx"
>>cTempRepName = "tmprep.frx"
>>USE (cReportName) in 0 alias TMPREPORT
>>if file( cTempRepName )
>> erase ( cTempRepName )
>>endif
>>select TMPREPORT
>>COPY TO ( cTempRepName )
>>USE in TMPREPORT
>>USE ( cTempRepName ) in 0 alias TMPREPORT
>>select TMPREPORT
>>goto 3
>>replace pagebreak with .F.
>>
>>
>>Do you see anything that I am missing in my code?
>>
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham