Find Last Record in Form - MAX Function?

Find Last Record in Form - MAX Function?

I have a form where the users inputs a sequence number (integer).  I would like to autopopulate this with a user input script (when the previous field is updated).  Is there a way to find the last record number?  I was look for a MAX function or something similar.

Thanks,