Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Record validation....
Message
From
08/11/2003 09:42:55
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
 
To
08/11/2003 09:29:13
Mike Sontillano
Travellers Life Assurance of the Philipp
Naga, Philippines
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00847924
Message ID:
00847929
Views:
21
>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)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform