Here is how I added an electronic keypad and lock to one of doors. I did this after locking my keys accidentally in the room.
Step 1: Keypad and Hole in the Wall.
I used a back-lit enforcer keypad. You can use any Keypad. They are all basically the same. Power wires, door unlock and then an output pair of wires.
I drilled a 3/4 inch hole through the wall to route wires to the keypad and inside the room.
Step 2: Solenoid Lock.
I chose to use a 12 volt solenoid to lock the door. This arrangement is fail locked. My entire lock system is fed from my solar battery bank so I have power anytime.
From the keypad I used a normally open relay output to energize this solenoid. You can use a magnetic latch if You prefer but you will have to use the normally closed contact instead.
Regardless of the lock or latch the routing of the wire to it is pretty routine. My Door is solid so I had no choice but to route the wiring externally in the room.
Step 3: Power and Wiring for Exit Button.
I used a 12 volt Dc power adapter and a 6inch square pvc box. I used an external relay to drive the solenoid. The exit button is just a pushbutton wired to the exit terminals on the keypad. Don't worry about the messy wiring. The cat5e cable there is the hardwire connection to my home automation pc.
Step 4: Lock Suicide Circuit.
I put this in case someone decided to unscrew the outside keypad and jumper the solenoid to energize and open the door. Basically it's a loop of wire physically attached to the keypad and upon lifting the keypad from its enclosure the wires will withdraw from the socket and de-energize the whole system. The only way to reattach the wires is inside the room which will remain locked.
Step 5: Remote Access Via Girder 6.
I used girder 6 to interface to this lock so I can open it with my phone. Really neat eh?
Take a look at my Instructable on that project.