Public rn as Integer

Public Function GetRn() AS Integer
    rn = rn +1
    return rn
End Function

-------------------------------------------------------
Now in the text box where you want the number to appear use the expression

=Code.GetRn