Function Run_CanPost not working as expected
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:
On Error Resume Next
‘ msgbox Run_Fields("RN_RUN_ID").Value
Run_CanPost = DefaultRes
select case Run_Fields("RN_STATUS").Value
if Run_Fields("RN_USER_01").IsNull then
msgbox "You should fill Blocking Reason field"
Run_CanPost = False
On Error GoTo 0
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.