I think you can skip the three lines here. You do not need to set the number of fields, the record will adjust as you set fields.