Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
=TableUpdate()
Message
 
 
À
24/01/2001 13:40:35
Chuck Tripi
University of Wisconsin - Milwaukee
Milwaukee, Wisconsin, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Divers
Thread ID:
00468066
Message ID:
00468099
Vues:
20
Sorry, that was incorrect. The code works only a regular index, not a primary or candidate key field. I never have a primary key field where the user actually enters the data. My PKs are always surrogate and integer that are generated.

If you want to do this, do not bind the control to a field. If you are going to do this regularly, create an ID textbox class with a cSource property:
local lcTable, lcField, lnSelect, lnRec, lnID, lnCount
lcTable = juststem(alltrim(This.cSource))  && mytable.fieldname
lcField = justext(alltrim(This.cSource))
lnSelect = select()
select (lcTable)
lnRec = recno()
lnID = This.Value
count to lnCount for ID = lnID
goto lnRec
if lnCount > 0
   ** Duplicate found
   select (lnSelect)
   return 0
endif
** otherwise the count was 0
replace &lcField with lnID
select (lnSelect)
return .t.
Mark McCasland
Midlothian, TX USA
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform