?
Solved

Invalid Command Name

Posted on 2011-05-02
7
Medium Priority
?
408 Views
Last Modified: 2012-05-11
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"
0
Comment
Question by:jaymz69
  • 3
  • 2
  • 2
7 Comments
 
LVL 4

Expert Comment

by:wcsoctu
ID: 35506081
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
 

Author Comment

by:jaymz69
ID: 35506094
where do you see the space?

Thanks
0
 
LVL 4

Expert Comment

by:wcsoctu
ID: 35506109
The datetime function returns a space before AM or PM.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:jaymz69
ID: 35506147
still get the same error on that line for:
COPT TO &docfilename
0
 
LVL 43

Accepted Solution

by:
pcelba earned 2000 total points
ID: 35506187
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
 
LVL 43

Expert Comment

by:pcelba
ID: 35506212
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
 

Author Closing Comment

by:jaymz69
ID: 35506262
That was it. I just found it in the MSDN site too

(docfilename)
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Visual FoxPro (short VFP) is a programming language with it’s own IDE and database, ranking somewhat between Access and VB.NET + SQL Server (Express). Product Description: http://msdn.microsoft.com/en-us/vfoxpro/default.aspx (http://msd…
Applications for our next round of the Experts Exchange Scholarship Contest are starting to roll in. It made us wonder what our past winners are up to these days. Here's a look at what four winners experienced with the contest and what they're doing…
Loops Section Overview
Screencast - Getting to Know the Pipeline

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question