Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Macro expansion issues
Message
De
18/10/2015 15:52:33
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 10
Network:
Windows 2008 Server
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01626098
Message ID:
01626105
Vues:
61
>I am now happily using WIN 10 if that matters.
>
>I I have a new install of VFP9 on this new box.
>
>This time, I left the spaces in the folder named "Visual Foxpro Projects".
>
>Yesterday and today an error popped up I have never before experienced in this old program. Error #36.
>
>Yesterday it was on a do form command, and today it was on a report form command. In both cases I have stored the form name or report name in an mv and then use the "&" to expand the mv.
>
>As in report form &MyReport to printer prompt or ;
>do form &MyForm with X,Y,Z to m.MyReturnValue.
>
>I solved the problem by using parentheses around the mv rather than the "&".
>
>The age old question would be, Why all of a sudden I would be faced with these errors?
>
>Did I forget one of the service packs or something? My VFP 9 version number is: 09.00.0000.5815.

You're getting the error because of the spaces in the path to your command. Macro expansion expands the contents of the variable before it's executed. So:
* If MyReport = "C:\SomeFolder\Visual FoxPro Projects\MyReport.frx"
* then your command becomes
REPORT FORM C:\SomeFolder\Visual FoxPro Projects\MyReport.frx ...
* so assuming the command even parses properly it would be looking
* for a report named C:\SomeFolder\Visual.frx
As you've discovered, using a name expression in places where VFP is expecting a name is the way to go: https://msdn.microsoft.com/en-US/library/4kxhy0aa%28v=vs.80%29.aspx . Macro expansion help at https://msdn.microsoft.com/en-US/library/1509cc9c%28v=vs.80%29.aspx

In general macro expansion should be your last resort. The order I use is:

1. Name expressions (preferred where applicable)
2. EVALUATE( )
3. & / macro expansion
Regards. Al

"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov

Neither a despot, nor a doormat, be

Every app wants to be a database app when it grows up
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform