PROCEDURE MyTextBox.Value
lNoDupe=.T.
IF THIS.DataBound AND !EMPTY(THIS.Value)
cExact=SET("EXACT")
cAlias=ALIAS()
SET EXACT ON
cCursor=JUSTSTEM(THIS.ControlSource)
cField =JUSTEXT(THIS.ControlSource)
cSource=THIS.ControlSource
cLUField="lookup."+cField
USE (cCursor) AGAIN IN 0 ALIAS lookup
SELECT lookup
DO CASE
CASE VARTYPE(EVAL(THIS.ControlSource))="C"
LOCA FOR UPPER(ALLT(&LUField))=UPPER(ALLT(&cSource)) AND ;
RECNO() # RECNO(cCursor)
IF !EOF()
lNoDupe=.F.
ENDIF
CASE yadayada (Cases for numeric, date, et al)
ENDCASE
USE IN lookup
SELECT (cAlias)
SET EXACT &cExact
ENDIF
RETURN lNoDupe
ENDPROC
>>Hi Jim, John, and Erik
>>
>>What about on an Edit as opposed to an Add? I know using Jim's method if I type in the same value I had, I will find my own record and fail. Will the other methods work?
>
>Mike,
>
>When you hit the same value you need to check if the record number is the same, if it is then it is not a duplicate and you need to skip to check the enxt record.------------------------------------------------
John Koziol, ex-MVP, ex-MS, ex-FoxTeam. Just call me "X"
"When the going gets weird, the weird turn pro" - Hunter Thompson (Gonzo) RIP 2/19/05