Newly added field is not saving on update?

Hi All,

I added a new field to a database via code

$sql = “ALTER TABLE invoices ADD COLUMN in_attn VARCHAR(25) NOT NULL”;
sc_exec_sql($sql);

It is just a text field, nothing fancy.

If I add a new invoice record, then the contents of that field in_attn is saved and re-appears if I open the record in update mode.

If I open a previously existing record, then that field is not saved.

I checked that that field is available for updates, and ran the sync routine under the application tab.

I am not sure what I have done wrong? Any ideas

Thanks

Tony

First of all I would maintain the database in the database manager (add the field there), then sync the forms that need it. In this case, the only thing I can think of is that you need to commit the transaction by using sc_commit_trans().

the sc_commit_trans() worked

Thanks for that - been driving me nuts for most of today :slight_smile:

Tony