Shouldn't matter if it is a new record or not. And since code is in form BeforeUpdate event, form must be dirty otherwise the event would not trigger.
What do you mean by "doesn't work as expected"? What happens - error message, wrong result, nothing?