Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Using a variable to store an object name
Message
 
À
05/06/1997 08:54:43
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00035059
Message ID:
00035571
Vues:
38
> >>>I wish to run the following line of code > >>> > >>>REPORT FORM REPORTNAME TO PRINTER > >>> > >>>where REPORTNAME is a variable containing the name of the report. Is > there a function which will locate the contents of reportname > >> > >>REPORT FORM &REPORTNAME. TO PRINTER > > > >Name substitution will work here, and is considered better code: > > > >REPORT FORM (lcReportName) TO PRINTER > > Macros are universal in VFP, so I consider them as better code. There's only one problem: they don't always work. For example, if m.ReportName = "C:\Program Files\Report.FRX" then your line of code will be COMPILED (by the mini-compiler mentioned elsewhere) as: report form C:\Program Files\Report.FRX TO PRINTER and FoxPro won't know what to do with the "Files\Report.FRX" clause. In this case, the long filename support of VFP has busted this code, and Named Expressions are more suitable. Yes, there are some situations where macro expansion is the only thing that will work, there are also some situations where it will not. The best practice seems to be to start with Named Expressions, and if that doesn't work, drop back to Macro Expansion as a last resort.
Paul Russell
EMail: prussell@fox.nstn.ca
Phone: (902) 499-5043
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform