>>If it's a global var, why are you sending it as a parameter?
>>Wouldn't the procedure have it available already?
>>Also, is the parameter name the same as the global var? If so PARAMETERS makes it private, which may kill it; LPARAMETERS makes it local, which will kill it.
>
>Hi,
>
>The procedure is called from anumber of different places and it is only sometimes a global variable is send as a parameter.
>
>The name of the globla variable is not the same as the parameter in the procedure. There is also no field with the same name as the variable or the parameter.
>
>Thanks for your thoughts...
I think I've found the problem. Do you invke the procedure with DO...WITH...? Passing a PUBLIC by REFERENCE (the default) results in the PUBLIC being hidden. the following code snippet demonstrates this nicely:
PUBLIC cTest
cTest = 'ByRef'
DO MyFunc WITH cTest
ctest = 'ByVal'
=MyFunc(cTest)
CANCEL
PROCEDURE MyFunc
LPARAMETER uVar
? uVar
? 'The type of the parameter is',TYPE('uVar')
? 'The type of the PUBLIC cTest is',TYPE('cTest')
RETURN
You can force a pass by value by invoking the procedure as a function, or by enclosing the argument to the WITH in parentheses to force a pass by value. This behavior of PUBLICs passed by reference is actually documented somewhere...