>>Hi,
>>
>>Could someone suggest why I am having a problem (actually not me but the customer) in the following segment of code:
>>
>>The container with the text box has a property control_source. This property has a value V_WORK.EMPLOYEE
>>
>>The code then checks is the value of the field EMPLOYEE in the cursor V_WORK has been change. Here is the code:
>>
>>
>> cControlSource = ALLTRIM( this.control_source )
>> IF EVALUATE( cControlSource ) == OLDVAL( cControlSource )
>> RETURN .T.
>> ENDIF
>>
>>
>>The problem occurs on the line above, EVALUATE( cControlSource ) == OLDVAL( cControlSource ), and it does
>>ALIAS IS NOT FOUND. I verified that the entry in .control_source exists as described above.
>>
>>TIA.
>>
>>UPDATE. the following code checks that the alias V_WORK exist and is open. This code, below, is before the code above (just in case someone wonders if the alias is indeed exists and open
>>
>>
>>IF !EMPTY( this.control_source )
>> cAlias = SUBSTR( ALLTRIM(this.control_source), 1, AT('.',ALLTRIM(this.control_source)) - 1)
>> IF SELECT( cAlias ) > 0
>> cControlSource = ALLTRIM( this.control_source )
>> IF EVALUATE( cControlSource ) == OLDVAL( cControlSource )
>> RETURN .T.
>> ENDIF
>> ENDIF
>>ENDIF
>>
>
>Hrm... Within the context in which the code you supply is running under, what does "THIS" refer to? Is it the textbox or the container in which the textbox resides?
>You state that "control_source" is a property of a container that refers to an alias.
>What is the "ControlSource" value of the textbox? Does it agree with the "Control_Source" value of the container?
The code above is executed in a method of a container. The container has a text box and a button (lookup up button). The text box has nothing in the ControlSource. The actual control source of this text box is taken from the container control_source.
And this code is executed in the method of the container, so, the THIS refers to the container.
I have tried the above code on my system; no problem. I have 5 other customers who use this code - no problem.
But I have two that experience the issue with the error message, as I wrote above.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham