Man tries to rob pharmacy of painkillers