Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Valid & Error events
Message
De
07/06/1998 10:07:54
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
 
 
À
05/06/1998 17:57:15
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00105397
Message ID:
00105609
Vues:
23
>Hello:
>
>I'm trying to figure out how to make the dammed form work properly, in the old days of FPW 2.6 you could have a valid routine like the following:
>
>IF SEEK(myvar)
>MESSAGEBOX("The ID number already exists",48,"Sorry but..")
>RETURN .F.
>ENDIF
>
>Now in VFP the lines are executed and return values per line so this is not possible, and besides, if your table's index is set as Primary, you get an error from the first line:
>
>SEEK(this.value) && Your valid event generates an Error, and there is no way as far as I've seen to keep the cursor in the same field, not even with an error routine that calls the objet's SetFocus event to force this.

You probably use some buffering, and your key is primary or candidate; as soon as you Seek, you change the record pointer; VFP implicitly TableUpdate()s your record, and fails because of the key violation (key already exists).

My workaround is to open the table twice, and seek in the other alias, never moving off the record in the main alias. So:
IF SEEK(myvar,1,"otheralias")
MESSAGEBOX("The ID number already exists",48,"Sorry but..")
RETURN .F.
ENDIF

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform