Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Seek function LIES!
Message
 
À
16/12/2003 10:54:22
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00859505
Message ID:
00859606
Vues:
15
Check to assure SET EXACT ON and SET UNIQUE OFF and make sure that if the key field reads "AP ", that the lookup key is PADR() to be the same lenght.


>I have a very simple routine in the valid of a text box. Valid searches for the value entered into the box. If the user is not in add mode, the record is brought up on screen for display. If the user is in add mode and the value is found, an error message is given to prevent duplicate entries. For some reason, this seek message is returning True regardless of the value entered IF, AND ONLY IF, you have previously entered a duplicate. For example, the user enters 'APPLE' and apple is in the table. The key is found and the proper message is returned. The user is returned to the field and now enteres 'BABY'. The seek is performed, the record is found (it's the new record from append blank) but the recno is NOT -1; recno remains on the record number of the original seek! Since recno is NOT -1, the second if below is evaluated as True and we get the message again.
>============ field valid code =========================
>LOCAL tkey
>tkey = this.Value
>IF ! EMPTY(tkey)
> IF SEEK(Tkey,"AP","chopap") AND RECNO() # -1
> IF thisform.r_laddmode
> =MESSAGEBOX("This code is already in use.",16,"DUPLICATE CODE NOT ALLOWED")
> RETURN .F.
> ELSE
> thisform.refresh()
> ENDIF
> ELSE
> IF ! thisform.r_laddmode
> =MESSAGEBOX("Code was not found.",16,"ENTER ANOTHER CODE")
> RETURN .f.
> ENDIF
> ENDIF
>ENDIF
>=================================================
>Questions:
>(1) Why does the record pointer remain on the previously sought record?
>and (2) What do I need to change to assure I catch duplicate records correctly on an add?
>
>TIA for your help!
Imagination is more important than knowledge
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform