>>>I would like to show memo field in textbox object. I have tried this
>>>SELECT SUBSTR(memofield,1,40) as field1 FROM tableA INTO CURSOR aa
>>>
>>>Thisform.mygrid.Column1.text1.ControlSource = 'aa.field1'
>>>
>>>The problem is the content of Column1 is showed as Memo, not as SUBSTR of memo field
>>
>>Something is wrong here. I think the field is going to be character field, since you substracting first 40 characters, so if you assign column's controlsource it should be just field, not a memo. Perhaps you have aa table somewhere in the path with the Memo field.
>>
>>Try to use different name for the cursor, same, curMyGrid.
>
>Yes, I thought that substring of memo field was character field, but it is not. The result is showed as memo field.
If VFP9 you can use CAST function, but I always thought that substracting is enough.
Try
select substr(myMemo,1,40) as myCharField from myTable into cursor curTest
=afields(laFields)
=messagebox(laFields(1,2))
You can also use a following trick in VFP8:
select space(40) as myCharField from myTable where 1=2 ;
union ;
select substr(myMemo,1,40) as myCharField ....
If it's not broken, fix it until it is.
My Blog