>hello,
>
>i created a table employee and created primary index on empno. when i created a form with a button ADD. it simply: APPEND BLANK.
>
>if i try to input record, it checks for the uniqueness of my field empno. this is fine, but how do i change the default foxpro message (uniqueness of.. etc..) to my own message (empno already exists)?
>
>i've been using foxpro for windows for 2 years, and i'm new to visual foxpro. pls help.
You can check if empno already exists :
if indexseek(m.empno,.f.,'myTable','empno') && exists
*Display your own message here
endif
However an easier way is not to make empno (or anything that's entered by users) a primary key. A primary key should be generated and used by you only IMHO. That way you can check if that exists anytime you want :
lnEmpno = mytable.empno
lnMyPrimaryKey = myTable.PKid
select cnt(*) from myTable ;
where empno = lnEmpNo and pkid # lnMyPrimaryKey ;
into array arrExists
if arrExists > 0
endif
Cetin