Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Trapping uniqe error
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00037301
Message ID:
00037360
Vues:
34
>You must verify the uniqueness before trying to update.
>
>Vlad
>
>>In my table I have a unique index on employee nr.
>>In my form if someone enter a duplicate emp. nr I get an error.
>>How do I trapp that error and make it possible for the user to revert??
>>
>>No I have ignore or cancel on ignore the message uniqness off record voilated just repeat.
>>On cancel my app goes down the drain.
>>
>>Best regards
>>
>>Per Simmersholm

Per, Vlad is correct. The easiest way is to USE mytable AGAIN order tag EMPNR ALIAS ENLOOKUP This will give you a second copy of your table, ordered by the Employee Nr. When working on a new record (you can check with Getfldstate()), then in the valid code seek the value just typed in. If it's found(), then you give your user an error message asking them to re-enter because it's a duplicate. Or you could give them an option to exit ADD mode and go to the existing record for the Employee Nr. they just entered.

This way, the value is checked BEFORE you save the record and BEFORE VFP's triggers fire.

Hope this is clear
Barbara
Barbara Paltiel, Paltiel Inc.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform