Edit

ChangePrimaryKeyCode (table, oldCode, newCode)

Result type:  Boolean

Definition:  Change a record's identifying code and update all usages in the database. Requires single user mode.

Returns true on success. On failure (false return), check GetLastErrorMessage() for an explanation.

In MoneyWorks 9.1.5, this function supported only changing tax codes. In 9.2.4 and later, it can also change product, account, and name codes.

Example:  ChangePrimaryKeyCode("taxrate", "N", "G")

Updates every instance of N tax code in the database to be G. This may take some time.

Availability:  MWScript in MoneyWorks 9.1.5 and later.