I have multiple users completing forms and submitting them to a single SharePoint library. I need a simple way to automatically assign a random or sequential four-digit number to a particular field: "Job_Number". This would preferably be done when the form opens. Then I could configure the "submit" buttom to refer to this job number. Any suggestions? Thanks.
There is a flaw in using random numbers.
A random number will not prevent two (or more) forms getting the same number. Random is not the answer for you if you want to guarantee uniqueness.
To get unique "job numbers" you will have to setup a database (SQL as a favorite) that will store a number, and a stored procedure that will get the request for the nubmer, increase it and return it as a transaction - make sure no two requests get the same number. Infopath will then trigger that SP every time a form is open.
This may cause some "jumps" in the numbering - when someojne opens a form and closes it without submitting, but seeing as how you were ok with random numbers I guess the sequence is not really important, as long as the newest forms have a higher number so you can sort by job number.