AddRecord erases data changes

I have found that if AddRecord exists in code after the code has edited data, that the edits to the datafield are lost. The examples are identical except for the AddRecord line.



Is there some setting I am missing

I don’t know exactly why, but I found this code works in Field Properties code box:

A=A+" nice"

I got this idea here:

If you put your code in a regular procedure, it will work fine.

In a procedure that is triggered by data entry, the addrecord statement is an absolute no-no. In fact, this code should not do ANYTHING that would change to a different current record - it should not add a record, move up or down, search or change to a different window. This code should only perform operations on the current record in the current window.

There is a way you can make this work, put a wait 0 statement in front of the addrecord statement.

wait 0

But really, I don’t recommend this even though it works.