Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I rename my report using the copy command?

Status
Not open for further replies.

MY3MCS

Technical User
Apr 17, 2003
49
0
0
GB
Hello everyone:

How can I rename my report form I created using the copy command and call the new report name to my program(.prg)?
EX. I created a report name "InvJune.frx"
I want it to be renamed "InvJuly.FRX" so that I can save this new report name to my PDF File.

Thanks

 
COPY FILE "invJune.frx" TO "InvJuly.frx"
COPY FILE "invJune.frt" TO "InvJuly.frt"

Slighthaze = NULL

[ul][li]FAQ184-2483
An excellent guide to getting a fast and accurate response to your questions in this forum.[/li][/ul]
 
Slighthaze:


Thanks a lot. Got it!!!
 
Slighthaze:

One more question please. What if I want the old file to be copied to a Memory Variable? Let's say:
Mmonth = Month(date())
in this case Mmonth is 7 because today is July 31, 2003
What is the command to copy the old file to become Inv7.frx?
And tomorrow since it will be Aug 1. My program should copy the old file and will name it Inv8.dbf. Is this possible? It means my new file name will depend on the month of the currentdate. I hope you got what i mean. thanks.
 
Local nMonth, cFirstName, cSecondName

nMonth = Month(date())

cFirstName = iif(nMonth = 1, "12", alltrim(str(nMonth - 1)))
cSecondName = "Inv" + alltrim(str(nMonth))

if file(cFirstName + ".frx")
COPY FILE (cFirstName + ".frx") TO (cSecondName + ".frx")
COPY FILE (cFirstName + ".frt") TO (cSecondName + ".frt")
endif


Slighthaze = NULL

[ul][li]FAQ184-2483
An excellent guide to getting a fast and accurate response to your questions in this forum.[/li][/ul]
 
Slighthaze:

Thanks a lot for helping me. I almost get it maybe one more question if you may:

I added this in my program after I followed your instructions:

Modify Report CsecondName

But the one opened up is the file "CsecondName" and not
"Inv7" as should be the new file name.

Can you tell me why?

Thanks again.
 
Modify Report (cSecondName)

...or...

Modify Report &cSecondName



...it's because it thinks cSecondName is the name of the report rather than a string variable holding the name of the report. Use either paranthesis around the variable (this is the preferred method) or use macro substitution as in the second example.

Slighthaze = NULL

[ul][li]FAQ184-2483
An excellent guide to getting a fast and accurate response to your questions in this forum.[/li][/ul]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top