>how can i not allow duplicate entries in my table? i have an add and save >button in my form. add does an append blank, then save does the >tableupdate. if record is already in my table, i don't want to do a >tableupdate.
>pls help. TIA.
Hi Evelyn,
Kung sa VFP Tables ka lang nag-aadd ng records, puwede kang maglagay nang validation rule.
Halimbawa,Sample lang to ha..
Meron kang
Customers table with field na
custid, unique at d eto running numbers. Code..
valid procedure for Txtcustid:
cCustid = Alltr(this.value)
Select("Customers")
Set order to tag CUSTID
GO TOP
IF !EOF() .OR. !BOF()
Set Exact on
Seek(cCustid)
If Seek(cCustid)
Messagebox("Duplicate records or records exist!",0+16,"Add",1900)
return 0
Endif
Set exact off
Endif
Applicable to sa pang-isahang record, isa pa, kung may Invoice Table, dapat meron ka ring unique field Invc_nbr
Ngayon, kung SQL Server data naka store your records mo, kailangang magexecute ka ng
stored procedure against sa table at hanapin kung may kapareho na siyang record at ibalik sa user.
Umpisan mo ang validation sa umpisa pa lang, huwag sa pag nagsave ka na ng record.Mas magandang validation yong umpisa para d sayang ang pag keyin ng User mo.
Puwede ka ring magcreate ng Database Triggers..