Link to home
Start Free TrialLog in
Avatar of jaymz69
jaymz69

asked on

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"
Avatar of wcsoctu
wcsoctu

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" ,' ','_')
Avatar of jaymz69

ASKER

where do you see the space?

Thanks
The datetime function returns a space before AM or PM.
Avatar of jaymz69

ASKER

still get the same error on that line for:
COPT TO &docfilename
ASKER CERTIFIED SOLUTION
Avatar of Pavel Celba
Pavel Celba
Flag of Czechia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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(...
Avatar of jaymz69

ASKER

That was it. I just found it in the MSDN site too

(docfilename)