> I have developed an application which uses over 17 tables from another application.
>
> I want to make a copy of each table with a new name in a folder and open each one.
>
> At present I am using the following code each time
>
> eg for TEMP_C
>
>
>
> SELECT TEMP_C
>
> myorigfilename ="TEMP_C"+'.dbf'
>
> mycopyfilename = "TEMP_CC"+'.dbf'
>
> CopyFile (myorigfilename , mycopyfilename, 0)
>
> myorigfilename ="TEMP_C"+'.fpt'
>
> mycopyfilename = "TEMP_CC"+'.fpt'
>
> CopyFile (myorigfilename , mycopyfilename, 0)
>
> *!* COPY to TEMP_CC - replaced by API call
>
> USE
>
> IF !used('TEMP_CC')
> USE TEMP_CC in 0
> ENDIF
>
>
>
> Can a clever more experienced coder than me put all this in a FOR NEXT form that I can use instead?
>
> I will manually create an array of the old TEMP filenames and corresponding new TEMP filenames as they will never change.
>
> I already have many prgs using the new filenames.
>
> I am doing this so that the tables form the original application are not changed by my app.
>
> Many thanks
>
> -Bryan
*
* Assuming that laTableInfo[] is a 2-dimensional array
* that contains the Original Table Name and the Name of the Copy...
*
* So, for example...
* laTableInfo[1,1]="TEMP_C"
* laTableInfo[1,2]="TEMP_CC"
*
for xx=1 to alen(laTableInfo,1)
for lnExt=1 to 3
lcExt=icase(lnExt=1,".DBF",lnExt=2,".FPT",".CDX")
if file(laTableInfo[xx,1]+lcExt)
CopyFile(laTableInfo[xx,1]+lcExt,laTableInfo[xx,2]+lcExt,0)
endif
endfor
if not used(laTableInfo[xx,2])
use (laTableInfo[xx,2]) in 0
endif
endfor
--Brad