*Update, sorry, I forgot to close the table first in my example also! I tested it and it works now, see the *remarks
Are you sure the table is not open anywhere? I do pretty much the same thing to create archives. Here is a portion of my code:
lcidx=ALIAS()
USE IN (lcidx)
xdir="\data\"
bakdir="\archives\"
lcarchshort="_"+lcidx+"_"+LEFT(TTOC(DATETIME(),1),12)
lcarchlong=bakdir+lcarchshort+".DBF"
lcarchtable=lcarchshort+".DBF"
IF FILE(xdir+lcidx+".DBF")
COPY FILE xdir+lcidx+".DBF" TO bakdir+lcarchshort+".DBF"
ENDIF
IF !FILE(bakdir+lcarchshort+".DBF")
MESSAGEBOX('An error occured archiving '+lcidx+CHR(13);
+'Please contact support.',16,'Error Archiving!',500000)
ENDIF
>I want to create a table with a date-stamp name. I tried the following code and I keep getting a "Cannot create file error". Can anyone help me? (I'm using VFP7)
>
>pay_dbf="\data\PR"+RIGHT(DTOS(Date()),6)+".dbf"
>
>Copy file payroll to &pay_dbf
>
>Thanks in Advance
.·*´¨)
.·`TCH
(..·*
010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"