> >>>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.