Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Searchable & No Double Entry
Message
 
À
28/04/2000 09:28:05
N. Lea
Nic Cross Enterprises
Valencia, Californie, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00364432
Message ID:
00364666
Vues:
19
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.
* Chk4Dup.prg		(c) 1999, Peisch Custom Software, Inc.

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!!
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform