welcome to the forum.
This takes me back to programming a TRS-80. Gosh, I feel old.
Your captured fields from Custom Dialog being "RecQty" and "StartNum":
Set Variable [$y;Table::StartNum + Table::RecQty]
Set Variable [$x;StartNum]
SetField [Table::SurveyID;district_id & "-" & school_code & "-" & $x]
Exit Loop If [$x = $y]
Set Variable [$x;$x+1]
I think that's got it...does it work for what you're after? Try it out with pauses built in to check the progress and giving yourself a bailout from the loop before you put it out for the public...