save previous record id for report function