Data Validity Custom Formula issue; stop with error message when another cell is empty

I’m trying to use a formula in Data Validity to create an error message when trying to enter any character in a specific cell when another cell remains empty- creating a “stop” with “error message”.

In the attached example I want entry into B2 to result in stop with error message only when A2 is empty.
Data Validation Issue.ods

I’ve never used a custom formula in validity before and I clearly haven’t grasped how it works- can someone put me right here?

Thanks.

I clearly haven’t grasped how it works

Formula evaluates to TRUE → Data entered is valid → Error Alert → Action not being called
Formula evaluates to FALSE → Data entered is invalid → Error Alert → Action will be executed

(hence you get an error if there is already data in your cell A2)

Your IF(A2="") returns TRUE if A2 is empty or a formula with empty string result, else FALSE. You want the opposite, and instead of testing for a string it’s best to test if the cell is not blank, i.e. has content, so for valid input test

NOT(ISBLANK(A2))