CREATE new record

TColeman

Member
I am trying to create a new record in a database table. My code is like this:

CREATE database.tablename NO-ERROR.

ASSIGN database.tablename.fieldname = newValue.

Instead of creating a new record the old record is being overwritten.

Am I missing something?

Thanks,

Terri
 

Chris Kelleher

Administrator
Staff member
Terri-

Since you have the NO-ERROR on the CREATE statement, you should check to see if an error occured while creating the record:
Code:
createcustomer:
DO TRANSACTION:
  CREATE customer NO-ERROR.
  IF ERROR-STATUS:ERROR THEN
  DO:
    MESSAGE "Could Not Create Customer" VIEW-AS ALERT-BOX ERROR.
    UNDO, LEAVE createcustomer.
  END.
  ELSE
  ASSIGN
    customer.name = "Whatever".
END.

HTH.

-Chris
 

TColeman

Member
Error-Status

I did later discover the ERROR-STATUS:ERROR and I used it however there is no error during the CREATE.

Maybe something else I am missing?

Thanks, Terri
 

Chris Kelleher

Administrator
Staff member
Terri-

Could you post a snippet of the exact code you are using... maybe we can track it down from there.

Thanks,
-Chris
 
Top