Runtime Error 387: “Property Set not permitted,” explained and fixed
Error 387, “Property Set not permitted”, fires when an object assignment is refused in the current circumstances, even though the property is not simply read-only. The classic setting is a property whose value the host controls while a form or document is in a particular mode: the assignment might be allowed in another state, but in this one the object's owner vetoes it. Where error 382 is about run-time versus design-time and 383 is about read-only, error 387 is about context: the same statement, in a different moment, could be legal.
For people who just run the program
- This is a developer-facing error in form and component code. Users encounter it when a tool tries to reconfigure something the hosting application currently has locked down.
- Note the state of the program when it fired. Was a wizard open, a record being edited, a preview running? For error 387 the surrounding mode is the material fact.
- Close dialogs and finish edits, then retry the action. If the action succeeds once the program is idle, the context explanation is confirmed and worth reporting as such.
- Report the number with the mode you were in. “Fails while the preview is open, works when it is closed” is a complete bug report for this error.
For people who write the code
- Identify the gatekeeper. Determine what owns the property's availability in the failing moment: the form's mode, an active transaction or edit, a modal state. The documentation for the specific property usually names the states in which it can be set.
- Sequence the assignment into a permitted window. Perform the assignment before entering the locking mode (at load, before showing, before beginning the edit) or defer it until the mode exits, the same deferral discipline used for unload problems.
' If a property cannot be set while editing is active:
' 1. Commit or cancel the edit
' 2. Perform the Set assignment
' 3. Re-enter the editing state if the workflow needs it
- Raise a clear error of your own. Library code that wraps such properties should catch 387 and re-raise with the context named (“cannot assign while a preview is active”), because the bare message sends callers hunting for a permissions problem that does not exist.
“Not permitted” here does not mean user permissions. It is not about administrator rights, file ACLs, or security policy. It is the object refusing an assignment in its current state, which is why running elevated never fixes error 387.
If it still happens
If the state is demonstrably idle and 387 persists, suspect a control hosted in a container with stricter rules than the same control standalone: some hosts (older containers, certain Office-hosted controls) veto assignments their native environment allows. Test the control in a plain form to isolate the container's role.
Common questions
How is error 387 different from error 383? Error 383 means the property is read-only, permanently. Error 387 means the assignment is not permitted in the current state or context; the same property may accept the assignment at another moment.
Can error 387 be intermittent? Yes, and that is its fingerprint. Because it depends on the program's mode, it appears only when the action is attempted during the locking state, and identical code succeeds at other times.
Related errors