Poughkeepsie police responded to a report of an attempted break-in Friday at a Montgomery Street apartment.
Armando Guillen-Ortiz, 28, was located and detained. He was later charged with criminal trespassing.
Guillen-Ortiz was also charged for possession of narcotics.
Hours after his release, patrol was dispatched to the same street for an unwanted male trying to get into a building.
Guillen-Ortiz was again taken into custody and is being held pending arraignment.