General information
Title:
CursorAdapter and 'The BeforeUpdate event has failed' messag
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.
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only