field valid method
pl.help what i am doing wrong cos when i add new dl_no( my field name) it same message coming " already exists"
i want to seek dl_no in checkcust table and if found get the message and focus on same field and if not the go to next field
SELECT CHECKCUST
SET ORDER TO DL_NO && DL_NO
SEEK dl_no
IF FOUND()
=messagebox("ALREADY EXISTS")
return .F.
ELSE
ENDIF
If you have a field named dl_no then this code would always show the messagebox.
I don't know where you're calling this code. Here is a sample doing that with a textbox control that DOESN'T have any controlsource set:
Code Snippet
* LostFocus
local lcOldExact
lcOldExact = set("exact")
set exact on
* Uppercase if needed
if seek(padr(this.Value, fsize("dl_no","checkcust")), "checkcust", "dl_no")
nodefault
this.SetFocus()
messagebox("Already Exists")
endif
set exact &lcOldExact
thanks for reply
i try this but get same messge
i have table with dl_no field
now i open form , when i put value in dl_field it get message already exists ( i think it seek this value too )
thanks
Yes I told you that before it would always return .T. for found if you have a field named dl_no. You can only use indexseek() on a buffered table for such an operation but as soon as you move off the record it is updated in index and always returns .t.
Maybe you're trying to do this:
Code Block
luCurrent = dl_no
lnRecno = recno()
locate for dl_no == m.luCurrent and recno() <> m.lnRecno
llExists = !eof()
go m.lnRecno
if m.llExists
messagebox("exists")
endif