Under certain circumstances, CURVAL() and OLDVAL() return the same value.
This is by design. CURVAL() and OLDVAL() only return different values when
the following two conditions are both true:
- Optimistic buffering is enabled.
- Another user has modified the current record in a table while you were
editing it.
In addition, CURVAL() and OLDVAL() return the same value if the all three
of the following conditions are met:
- Two forms in the same Visual FoxPro session are using the same table.
- The data on one instance of the form has been modified.
- The data on another instance of the form has not been modified.
In this case, CURVAL() does not return a different value because the two
instances of the forms share a data session by default. Because the user
has locked the record in the first form, the data session in the second
form considers itself to have locked the record as well.
Choose one of the following threee alternatives:
- If you want to write code to determine if the current user has modified
the current record, use the GETFLDSTATE() function. The GETFLDSTATE()
function returns a numeric value indicating if one or more fields in
the current record have changed, if a record was appended, or if the
deletion status of the current record has changed. For more information
on using GETFLDSTATE(), please see the Visual FoxPro Help file.
-or-
-
-or-
If you want to test code in a multiuser scenario, you must have two data
sessions running. To do this:
- Run two instances of Visual FoxPro simultaneously on the same or
networked computers.
-or-
-
-or-Set the DataSession property of the form to 2 - Private Data Session,
and run two instances of the form.
-or-
-
-or-
If you are using pessimistic buffering, or no buffering, change to
optimistic row or table buffering by using the CURSORSETPROP() function
in the init method of the form. For example, enter the following command
to set optimistic table buffering:
=CURSORSETPROP("BUFFERING",5)