Sometimes the problem with a door lock not catching comes from within the door. If the lock becomes too dry, it may begin to stick whenever the doorknob is turned. Generally, moving the doorknob back and forth dislodges the stuck lock temporarily, but for a more permanent solution, you must oil the lock. This can be accomplished by spraying the lock and the inside of the locking mechanism where the lock is housed with a lubricant.
If the lock of a locking mechanism on a door works fine and a door lock won’t catch, it’s likely a problem with the catch on the doorjamb. Objects may become lodged inside the hole into which the door lock goes and thus prevent the lock from extending into the jamb. If the jamb is clear of obstructions, check that the latch on the door extends far enough to reach the jamb. Sometimes the space between the door and the doorjamb is too wide and the latch isn’t long enough.
Misaligned Latch and Jamb
If the door lock protrudes far enough from the door to insert in the catch on the doorjamb, but the two pieces are misaligned on the door, the lock may fail to catch. When you close the door, the piece on the door where the lock comes out and the opening of the catch on the doorjamb should line up exactly and have less than 1/8-inch of space between them. If they don’t line up or there is too much space, the units must be realigned.
You could realign the lock in a door with a catch in the doorjamb in a couple of ways. First, wiggle the faceplate of the door lock and the catch on the jamb to ensure that both are tight. If they feel loose, tighten the screws until both feel snug. If this doesn’t work, and the alignment is severely off, you may need to remove the catch from the doorjamb, fill in the hole where the catch was with wood filler, and reinstall the catch so that it lines up with the lock.