Hi Luke,
I am glad you found a solution, which works for your case.
Curious, if you do this ," I set up a data connection to query the Ref Number column in the document library and the form adds 1 to the highest value" on Form Load?
If so and several people open and take their time (let say an hour to complete) and more people open/start same data entry on another instance of the form, wont they all get the same new ID (Ref #)?
If you do the Ref#/Max-value lookup on clicking Submit, then most likely you will be fine in 99% of the cases, otherwise see below:
Maybe I am missing something, but unless you can somehow "reserve" the IDs or never have more than one person working at a time with this form (in a network /Sharepoint environment) it is likely to get duplicate IDs. Only once you save the particular form you can get a unique ID (numerical, not date-conversion based) from system.
Just to clarify, I found that it works best if I do a double-save (fast/hidden submit, then use the secondary connection to pull the Form ID from Form Library and assign to whatever form field you need, then do a final submit/close). This way my forms always have and know their unique IDs (numerical). I even rename the Form Name in Library to use that numerical ID, so my Forms show something like ABC-12-1247 on the form pages and the the filename, for cases when downloaded for offline use.