Hi Galen,
>I have a form property called thisform.filename initialized to "c:\test\test.dbf"
>When I run a query using "Select * From &thisform.filename" it errors saying the table is not found.
As Glenn pointed out, you're better off using a "name expression." Name expressions are shown in parenthesis and are always faster than macro expansion. The code would look like
SELECT * FROM (ThisForm.FileName)
You can use a name expression anywhere that VFP expects a name.
From the Macro Expansion Help topic:
Tip Whenever possible, use a name expression instead of macro substitution. A name expression operates like macro substitution. However, a name expression is limited to passing character strings as names. Use a name expression for significantly faster processing if a command or function accepts a name (a file name, window name, menu name, and so on). For additional information on name expressions, see Name Expression Creation.>Is it that a form property is not really a variable as far as macro substition is concerned.
When using macro expansion with an object property you use two dots - one is the usual dot and the other denotes that the macro expansion ends "here." The expression would look like:
SCATTER NAME THISFORM.MyProperty
lcProperty = "MyProperty"
? THISFORM.&lcProperty..Field1
I tried every combination of your ThisForm.FileName property and "&" and extra dots and always got an error of some sort, but I can't say exactly why it doesn't work.