Why would the cabin crew have the code? The code is for the pilots. If the cabin crew want to come in then the pilots unlock the door from the inside. If your'e talking about eliminating edge cases, giving the entire cabin crew the code is a great place to start looking.
Erm, this is a good idea, but surely the cabin crew WOULD have the code. If one pilot incapacitates the other, the cabin crew realize the plane is going down, they need to get into the cockpit. It's OK because as long as both pilots are AOK, you can't get in - terrorists locked out. But one crazy pilot tries to crash the plane, the second one refuses to stop the door unlocking - plane saved.