Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

validation of primary key entries

Status
Not open for further replies.

abbyanu

IS-IT--Management
Jan 18, 2001
82
US
hi

i'm trying to do a validation on the primary key field, to ensure that user does not enter a new record that already exists. is there asny way i can accomplish this without using buffering?

the text boxes i'm using for data entry are bound to the table, and i'm using APPEND BLANK to add a blank record. However i can't get it to validate if a user enters an existing record.

Please help.
 
Hi!

Use SELEC-SQL statement for this. For example:
select myID from myTable where MyID = MyTableAlias.MyCyrrentID into array aaa
if _tally > 0
= messagebox('Record is not unique!')
endif

Now, replace names in the query to the names in your application. Condition of query (after WHERE word) is just a condition required to try to find similar record to what is entered. Entered record - current record in the MyTableAlias cursor. Result of query is in array (memory variable), you can ignore it, you just need to see of query returns any records.

Vlad Grynchyshyn
vgryn@softserve.lviv.ua
The professional level of programmer could be determined by level of stupidity of his/her bugs
 
P.S. or you could check out the FAQ area of this forum for more ideas on the same subject David W. Grewe
Dave@internationalbid.com
ICQ VFP ActiveList #46145644
 
Thanks folks for your kind assistance. I've made some headway.

Peace!
Abe Anunda.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top