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:
00468083
Vues:
19
Put code in the VALID method of the ID textbox to count how many IDs are equal to the current value of textbox. The count should be exactly 1. The only other possible count is 2. The current record will always be included in the count.
local lcTable, lnSelect, lnRec, lnID, lnCount
lcTable = juststem(This.ControlSource)
lnSelect = select()
select (lcTable)
lnRec = recno()
lnID = This.Value
count to lnCount for ID = lnID
goto lnRec
select (lnSelect)
if lnCount > 1
   ** Duplicate found
   return 0
endif
return .t.
>VFP 6.0 (SP4)
>
>I have a Primary key in a table. The reason is it can not have any duplicate ID. Oddly that it only checks AFTER leaving the RECORD, not after leaving the FIELD itself? It doesn't sound right, since it sometimes gives the error message (of dupe ID) right away upon leaving the field itself (but remain in the same record) and other times it doesn't? That ID field is INPUTTED by the user.
>
>Whatever the case is, I need to check for the ID before can proceeding with the data entry. So, in the form, where in the field text property would I put the "=TableUpdate()"?
>
>If there is a better way to do it, please let me know. So far, I have all fields disabled until the ID is non-dupe, then enable the rest of the fields (for inputting other data).
>
>Chuck
Mark McCasland
Midlothian, TX USA
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform