Thanks Paul.
>Hi Tracy,
> Because #DEFINE's work different than variables. You can't EVALUATE() a #DEFINE because the text (at least in OTHER languages) is evaluated when the code is compiled, and not on the fly at run-time. I believe Fox interprets these the same way.
>
>#DEFINE myName "Paul"
>
>At compile time, everywhere myName is found in code, it is replaced with "Paul". When the code is run, it doesn't know that myName exists anymore. It just knows 'Paul'. Putting in a breakpoint and checking for UGI_CCONFEE in your locals should confirm this. It won't be there.
>
>
>>I have in a method of a form:
>>
>>FOR m.icounter = 1 TO THISFORM.ControlCount
>> oControl = ThisForm.Controls[m.icounter]
>> IF ALLTRIM(UPPER(oControl.Baseclass)) = "TEXTBOX"
>> IF !EMPTY(oControl.Tag) .and. !EMPTY(oControl.controlsource)
>> TRY
>> qtag = ocontrol.Tag
>> qnewval = EVALUATE(oControl.controlSource)
>> qtype = TYPE('EVALUATE(oControl.controlsource)')
>> qsysnum = thisform.ca_sysnum
>> qagnum = thisform.ca_ag_num
>> *UWUSRCreate is a program part of which is shown below
>> =UWUSRCreate(qTag,qnewval,qtype,qsysnum,qagnum)
>> CATCH
>> ENDTRY
>> ENDIF
>> ENDIF
>>ENDFOR
>>
>>A snapshot of the UWUSRCreate function:
>>
>>LPARAMETERS tRecord, tValue, tType, tCoId, tAgId
>>
>>*I verified that at this point the following values are correct:
>>*tRecord = "UGI_CCONFEE"
>>*tValue = 1.15
>>*tType = "N"
>>*tcoId = 12
>>*tAgId = ""
>>
>>#DEFINE UGI_CCONFEE 8159760
>>
>>TRY
>> iGroupID = EVALUATE(tRecord)
>>CATCH
>> iGroupID = 0
>>ENDTRY
>>
>>Yet this works from the command window:
>>
>>UGI_CCONFEE = 8159760
>>trecord = "UGI_CCONFEE"
>>?EVALUATE(trecord) && returns 8159760 as it should
>>
>>Why does it not work in my program using #DEFINE? I must be overlooking something basic... ?
>>
>>TIA,
>>Tracy
.·*´¨)
.·`TCH
(..·*
010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"