For the future, you'll need the code any time the radio loses power. The radio has no way of telling whether it's just lost power or if it's been stolen. If you have the code, you should be able to enter it into the radio somehow, and and you can avoid the trip to the dealer. If you have to get the radio unlocked by the dealer, have them give you the code, and make sure you know how to enter it, since you may well find yourself in this situation again if your battery goes flat or has to be removed again.