Invalid Command Name

I am looking into another person program and they store the path :

Store  "X:\Main\Dept\Acc\Re\IDOCS-"+ Stuff(Stuff(Stuff(Stuff(Stuff(Ttoc(Datetime()),17,1,""),14,1,""),11,1,"."),6,3,""),3,1,"")+".dbf" To m.docfilename

the select does its thing and then this code follows:
COPY TO &docfilename

VFP gives the error "Command contains unrecognized phrase\keyword"
jaymz69Asked:
Who is Participating?
 
pcelbaCommented:
No need to transform the filename. Spaces in filenames are allowed in VFP. You just have to enclose the name in (double) quotes or use the name expression:

COPY TO "&docfilename"

COPY TO (m.docfilename)
0
 
wcsoctuCommented:
Your file name has a space in it.  Wrap in STRTRAN function when storing the name.
strtran("X:\Main\Dept\Acc\Re\IDOCS-"+ Stuff(Stuff(Stuff(Stuff(Stuff(Ttoc(Datetime()),17,1,""),14,1,""),11,1,"."),6,3,""),3,1,"")+".dbf" ,' ','_')
0
 
jaymz69Author Commented:
where do you see the space?

Thanks
0
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

 
wcsoctuCommented:
The datetime function returns a space before AM or PM.
0
 
jaymz69Author Commented:
still get the same error on that line for:
COPT TO &docfilename
0
 
pcelbaCommented:
The TTOC() result depends on the SET DATE setting and would recommend to change it for some nonambiguous format, e.g.  TTOC(DATETIME(),1)

And you can remove stuff(stuff(stuff(...
0
 
jaymz69Author Commented:
That was it. I just found it in the MSDN site too

(docfilename)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.