Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Add/Edit Records - conflicts with candidate index
Message
De
18/07/2002 19:07:59
Irv Adams
MSC Managed Care, Inc.
Floride, États-Unis
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00679934
Message ID:
00680259
Vues:
19
Ria:

You can try something like this, but of course the trouble will be getting out of it if they just don't know a proper # to use, so you may want to code a safeguard:

In the Field1 TextBox.Lostfocus():
IF !Seek(ALLTRIM(THIS.Value),'MyTable')      && proper index set...
    Messagebox("Must have a match!")
    NODEFAULT
Endif
(this works sort-of like Valid but is more powerful and flexible in my opinion...)

You may want to try using a 'hidden' Unique key like the SYS(2015) function for Parent-Child relations, assigned to a field that is automatically populated. That way, if they don't enter a unique key at the moment, it can be corrected later and your Relations and such remain intact.

HTH,

-Irv.


>Hi,
>
>I have A form where all the controls are bound to a table. Field1 in my table has a candidate index defined on it. How do I allow users to add/edit records and make sure that field1 is not duplicated. I tried to trap the error number '1884', but it did not work.
>
>Any help will be appreciated.
>
>Ria
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform