I want to control that when the “Run” goes to Blocked status, it’s mandatory to fill the user defined field "RN_USER_01", labeled as “Blocking Reason”.
I have typed next code in the Run_CanPost function:

Function Run_CanPost
On Error Resume Next
‘ msgbox Run_Fields("RN_RUN_ID").Value
Run_CanPost = DefaultRes
select case Run_Fields("RN_STATUS").Value
case "Blocked"
if Run_Fields("RN_USER_01").IsNull then
msgbox "You should fill Blocking Reason field"
Run_CanPost = False
end if
end select
On Error GoTo 0
End Function

The problem is that sometimes works and sometimes not.
I have realized, debugging with message boxes, that it’s not working when the Run_CanPost function doesn’t take the right Run entity.
The problem is that I don’t know why this function fails getting the right Run entity.
Sometimes it gets stuck in a Run entity opened previously.