LDR circuit with relay
When I try to remove the 9v battery and run the LDR circuit off of the same 12v power supply the lock unlocks when light hits the LDR and then when the light is gone it never locks again. I have to move the pot all the way down in order to get it to lock. Any idea whats going on here?


Your circuit is really simple and therefore very dependent on the component values, tolerances and things like supply voltage.

A quick and easy fix would be to connect the LDR to 12V with a 3V or 3.3V Zener-diode in series. That will drop the voltage from 12V to about 9V and your circuit will likely start to work again.

Since you've mentioned that you're triggering a lock: The lock is likely a  electromagnet and the same precautions as driving a relay apply: Do you have a flyback diode in parallel to the lock? If not, please add one. The transistor will thank you.