Display next record +1 on next Add row in SubForn

Display next record +1 on next Add row in SubForn

Hi I'm trying to have the next field to be = Previous record value + 1 so I can start working adding Lines every time the user hits Add new in the Item_Sub Form.

Try this but only pass as result = 2 to all new records.

x=(row.Number  +  1);
row.Number=x;


I'm completely new on this code trying to learn.

Your help will be greatly appreciated.