Here's a utility I use to check for duplicates. It doesn't absolutely have to have a tag on the field you're checking on, but it would be optimized if there is one.
lparameters pNewVal, pFld
local lFnd, lOldRec, lOldAli
lFnd = .F.
lOldRec = recno()
lOldAli = alias()
select 0
use dbf(lOldAli) again alias DupChk
locate for eval(pFld) = pNewVal
if found()
do while .T.
if recno() = lOldRec
continue
else
lFnd = .T.
exit
endif
if eof()
exit
endif
enddo
endif
if lFnd
messagebox('Cannot enter duplicates in this field',48,'Duplicate found')
endif
use in DupChk
select (lOldAli)
return not lFnd
>I am trying to create a form containing personnel data, which allows the user to search via first or last name. At the same time, I am trying to allow the user to enter a new entry, but let the system prompt the user if that new entry has already listed in the table (double posting). I have the search taken care of (I am using a self created class for that).
>
>I can't seem to quite grasp the double entry method w/out killing that class. In my mind, I know I need to use a SEEK command, but that as far as I can get. Any ideas would be VERY helpful!!