Problem with a primary key when creating a new record in Forms
486262Nov 9 2006 — edited Nov 9 2006My table has a field - MDD_KEY - that is a primary key. It is updated from a sequence with a before-insert database trigger. I know this works properly as the primary key was accurately populated when I inserted 1433 records.
In Forms 6, I have a form based on that table. I have set the mdd_key as a hidden field because I assume it will be entered by the before-insert trigger. However, when I enter data into the table, and then try to save it, I get a FRM-40202: Field must be entered. - followed by - FRM-40222: Disabled item MDD_KEY failed validation.
If I set DATA Required to no, when I try to save I get an FRM-40600: Record has already been inserted - but no such record exists in the database. I know this record is unique and does NOT exist because I deliberately made it up.
In the property palatte, the attributes of the field are:
DATA Data Type Number
Required Yes
DATABASE Database Item Yes
Primary Key Yes
Query Only No
Query Allowed Yes
Query Length 0
Insert Allowed Yes
Update Allowed Yes
Update Only if Null No
Lock Record No
I assume that my problem is that with a new record, the form wants to see the MDD_KEY populated before it saves - but that isn't going to happen until the before insert trigger fires in the database. I assume I have to populate that field within forms, but how do I do that without messing up the database trigger/sequence? I will have to load more data directly into the database - so I need the database trigger in place.
I have not used primary keys before so I am more than a little bit confused about how and when it should be populated when a new record is created in Forms.
Any help would be appreciated as I cannot enter new data into my form (works well with existing data).
Thanks
Glenn