General information
Category:
Coding, syntax & commands
Title:
TABLEUPDATE Help!!!
On tables that have OPT ROW BUFFERING (i.e. #3 set in DATA ENVIRONMENT), should TABLEUPDATE(.T.) cause an error when when two users have changed data in the same table at the same time. 'Cause I thought it was supposed to!
I have several tables open at once on a given form. Before my SKIP+1 code I have:
< SELECT A
< TABLEUPDATE(.T.)
< SELECT B
< TABLEUPDATE(.T.)
< SELECT C
< TABLEUPDATE(.T.)
and then
< SKIP +1 code
I have an ON ERROR routine that goes something like:
< CASE error() = 1585 or error()=1595 &&UPDATE Violation
< ask=MESSAGEBOX("Update violation in "+alias()+Chr(13);
< "Someone else modified the same record at the same time"+chr(13)+;
< "You now have two choices:"+chr(13)+;
< " OK = OVERWRITE THEIR changes, or;"+chr(13)+;
< " CANCEL = To UNDO YOUR changes.", 1+48+256, "ERROR: UPDATE VIOLATION")
< IF ask = 1
< TABLEUPDATE(.t.,.t.)
< ELSE
< TABLEREVERT(.t.)
< ENDIF
Apparently, contrary to all of the doc I have read, TABLEUPDATE(.T.) does not cause an error() when there is a conflict. In my case, the error only occurs when I try to SKIP+1. To verify this I:
1: created a button with nothing but my TABLEUPDATE(.t.) code
2: launched my .exe twice
3: edited the same record in each of the two 'sessions'
4: moved one of the 'sessions' to the next record using my 'SKIP+1' code (which has TABLEUPDATE code before the SKIP+1)
5: clicked my TABLEUPDATE ONLY button in the second 'session'
BUT NOTHING HAPPENED!!!! No ERRORS!!! Why NOT???? Errors only occured when I tried to SKIP+1 in the second 'session'. This meant that my error trapping code did not function because the selected table for SKIP+1 was NOT the table that had the problem.
The solution (I think) is to get TABLEUPDATE(.T.) to cause the error and not SKIP+1 but how the @$@#$ do I do that?
Ideas????
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