Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
CursorAdapter and 'The BeforeUpdate event has failed' me
Message
De
29/05/2003 16:24:44
 
 
À
29/05/2003 14:19:45
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00794091
Message ID:
00794192
Vues:
18
>I have a CursorAdapter using SQL via ODBC using buferring row.
>I am trying to make some validations in the BeforeUpdate event of my CursorAdapter. According to the help, if my code return .F., VFP will cancel the TABLEUPDATE operation. So, I put some code like that:
>
>
>
>In CursorAdapter - BeforeUpdate Event
>
>SELECT tablename
>
>IF valorunitario = 0
> MESSAGEBOX( "The value is not valid...")
> RETURN .F.
>ENDIF
>
>
>It´s working fine, and after the RETURN .F., VFP really cancel the tableupdate operation and keep the record in buffer.
>The problem is: I have grid bounded to this table, and, if I trie to update the record just moving to another record (in this case VFP will trigger the Tableupdate automatically), if the field valorunitario is zero, then the message "The value is not valid.." will display correctly but when my code RETURN .F., the message "The 'BeforeUpdate' event has failed" will display twice. I can´t control that. The thing that is interesting is that, if you make a TABLEUPDATE manually, this message doesn´t appears. Does somebody know how to avoid this message?
>
>Note: I put the validation in BeforeUpdate event and not in the BeforeCursorUpdate event, because this last one is not trigged when you move to other record and VPF will try to make a tableupdate automatically.
>
>Thanks.
>Ricardo.

Hi Ricardo,

Call
Error( "The value is not valid...")
instead of
MESSAGEBOX( "The value is not valid...")
Thanks,
Aleksey.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform