Thanks! From time to time it really suprises my what basic things I've missed although I been using FoxPro for almost 7 years now... Is there any good book around where I can get a grip of all this "small" things that makes life easier and my coding safer?
/Mårten Törnquist
>>Take a look at the following program:
>>
>>PROCEDURE TEST
>> LOCAL cTest
>>
>> set udfparms to value
>>
>> cTest = 'Before executing TEST2'
>> ? cTest
>> do TEST2 with cTest
>
>Your problem lies here - all DO statements pass variables by reference; if you need to pass by value, either invoke as a function, or encapsulate thge argument in () to force the value only to be passed
>
>> ? cTest
>>
>> return
>>ENDPROC
>>
>>PROCEDURE TEST2
>> LPARAMETER cTest2
>>
>> cTest2 = cTest2 + ", and now I'm executing TEST2"
>> ? cTest2
>>
>> return
>>ENDPROC
>>
>>
>>Gives the following result when I run TEST from command window:
>>Before executing TEST2
>>Before executing TEST2, and now I'm executing TEST2
>>Before executing TEST2, and now I'm executing TEST2
>>
>>Why is my local variable in procedure TEST changed? Shuldn't the value be the same when I return from TEST2? Both procedures is in the same prg file and I'm running VFP6 with SP3.
>>
>>/Mårten Törnquist
---( Mårten Törnquist )---