Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to enforce an index?
Message
From
12/09/1999 11:47:05
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00263667
Message ID:
00263779
Views:
23
Exactly. You can even automate it in a class with a few new properties (VFP6):

DataBound property (Logical) .T. = Bound to data, .F. = Not

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
Previous
Reply
Map
View

Click here to load this message in the networking platform