Should be a default factory code that came with the safe that "should" work regardless of the battery condition. The code would be in the original paperwork of the safe.
Mine is the same as Gary's. There is the main battery and then a small hearing aid battery to provide juice to the memory when the main is being changed. Mine is a Sentry. They recommend changing both if the main goes kapoot.
My other safe has an "emergency key" where you remove the keypad cover and insert the key to open the safe if there is a problem with the keypad or battery.
Kubota 1120 RTV Kioti DK-40, MF-135, Ventrac 4500Y
Boy talk about getting lucky. It worked this morning so I changed the battery. The old battery had less than 8 volts to it. They say in the book to change the battery only when door is open. Why? I don't know.