Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Record validation....
Message
De
08/11/2003 09:42:55
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
 
À
08/11/2003 09:29:13
Mike Sontillano
Travellers Life Assurance of the Philipp
Naga, Philippines
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00847924
Message ID:
00847929
Vues:
22
>Hi all,
>
>I have a data entry in a grid, after I entered all data, I want to validate the record for duplicate entry (ex. name) in the "SAVE" command button. I used 5-Buffering. How to do this? Please advice..
>
>Thanks.
>Mike

I see two possibilities here.

One, use a candidate index. This will not allow duplicate values. TableUpdate() will fail; with aerror() you can find out the cause, why the update fails.

Another possibility is to write a small function that accepts the table name, the index name, and the current record number. This function must open the table AGAIN, and search whether the value exists already (but with a different recno()).

Personally, I combine both possibilities. The candidate index gives greater safety for the data, and the UDF makes it easier to give personalized messages. (Using the candidate index alone, the framework will simply say that there is a duplicate value, but not, which field(s) are duplicate.)
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform