Stop loop when no recs found