I agree with your code Marcia. But this the character field which you are replacing is just for user purpose. Internally I want the thing to be connected using an iID a unique integer. This character field is in my view but comes from a joined lookup table this view is updatable only on the main table for which the view is, the character field which comes from the lookup table is non updatable. I am using CodeBook and it's concepts.
>
Maybe I missed explaining but I have a autocomplete combo. So the whole logic hinges on a joined character field in the view. In the end the whole thing will be based in the iID as the connecting link, which is what I am replacing in the ReplaceID().>
>This is all very confusing. All you need is to call this method from your KeyPress to handle auto complete:
>
>
>LOCAL lcSofar, lnSelStart, lnSelLength, lnRow
>
>WITH This
> *** Handle backspace key
> IF LASTKEY() = 127
> .SelStart = .SelStart - 1
> ENDIF
> *** Get the value typed in so far
> lnSelStart = .SelStart
> lcSofar = LEFT( .DisplayValue, lnSelStart )
> *** Find a match in column #1 of the combo's internal list
> FOR lnRow = 1 TO .ListCount
> IF UPPER( .List[ lnRow, 1 ] ) = UPPER( lcSoFar )
> .ListIndex = lnRow
> EXIT
> ENDIF
> ENDFOR
> *** Highlight the portion of the value after the insertion point
> .SelStart = lnSelStart
> lnSelLength = LEN( ALLTRIM( .DisplayValue ) ) - lnSelStart
> IF lnSelLength > 0
> .SelLength = lnSelLength
> ENDIF
>ENDWITH
>