We possess an SQL table containing 2 primary keys, while the rest of the keys are considered normal. I have established an IDO for this table and linked these properties to a form. However, upon saving a record, the initial field, which is one of the primary keys, becomes automatically disabled. Nevertheless, our intention is to disable all primary keys to prevent any modifications from being made.
Is there a way to disable all primary keys without changing the form script? Currently, I am using the "Enable When" option in the form script by setting a flag to enable the primary keys for new records and vice versa. However, I would like to know if there is an alternative method to achieve this without modifying the form script.
Sub EnableFields()
Dim bIsNew As boolean
bIsNew = ThisForm.PrimaryIDOCollection.IsCurrentObjectNew
If bIsNew Then
ThisForm.Variables("KeyPropertyEnabled").SetValue("1")
Else
ThisForm.Variables("KeyPropertyEnabled").SetValue("0")
End If
End Sub