Remote locking problem E38 2000

My key stopped operating the locking or the alarm fairly suddenly last week.
Unlock, open windows and boot unlock still work. Lock, close windows has only worked once since.
Doors still lock and one can apparently set the alarm from the driver's door.
I got a spare key with it and as it was already flat, when I charged it (by using it on a long trip with the main one on the ring) it had forgotten its codes.
I think it is the key. Does anyone know better or know how to be sure one has [inductively] charged the other and how to program it to the car?
TIA
Regards
--

R. Mark Clayton

snipped-for-privacy@btinternet.com
  Click to see the full signature.
Add pictures here
‚úĖ
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

Motorsforum.com is a website by car enthusiasts for car enthusiasts. It is not affiliated with any of the car or spare part manufacturers or car dealers discussed here. All logos and trade names are the property of their respective owners.