David - thanks for your thoughts. You obviously have the same key as me. In this case the middle button disarms the alarms and immobiliser but does not unlock the doors. The door buttons just stay up or down depending on where they were when I pressed the middle button. The top button, which is supposed to lock the doors, just sets off the alarm for three blips. However, the CDL switch on the centre console locks and unlocks the doors just fine. I have a second key which behaves in exactly the same way.
But, both keys are 2-3 years old and may both need new batteries. I will try swapping them out and see what happens.
PS The distance from the car might be significant but in this case I am in a garage and only 2-3 feet away from the front of the car - where the key always used to work OK.