Greetings,
You have a couple of options depending on whether you need to display the number when the form is created, or saved.
You will need a 'Back-end' data store - most likely a database with a table that at a minimum keeps track of the last used number.
If you are saving the data from the form into a database, you could return the number to the user after saving the data ( and generating the associated number )
If you are wanting to display the number when the form is first opened, you will need to set up an action profile that fires when the form opens to call the back-end and get the next number.
There is no guarantee that the user will save this form, so you may end up with gaps in your sequence if you are assigning numbers other than when saving.
The forum has many posts on loading data into forms before presentation, and also some on using web services to push and pull data from forms.
Hope this helps
Mark