Hi InfoPathStartup and welcome to our forum!
Clay forgot to mention that the Web service we provide (which is free for developers) actually supports exactly the functionality that you need out of the box. We call it RefID support. You can specify a static code UR followed by an xpath to a field that receives the concatenated string. The Web service controls this when you submit the form.
The simplest solution is to increment this on submit since that's the time when the data is stored. If you try to increment this on load of the form, the user could go offline, or close the form which produces a gap in the ids or some dummy data. My recommendation would be to do this on submit. After the initial form is submit, you can refer to the ID on your form since the form is now stored in SQL or SharePoint or wherever.
If UR doesn't change, I recommend having a field that concatenates the ID with UR on load, but only if the form is loaded from an existing location (i.e., it's not new). There is a IsNew method in the InfoPath OM that you can use. We have some code lying around that also uses SharePoint. SharePoint sits on top of SQL but limits access to the database. However, you can still get the ID from the data exposed in SharePoint. If you would like to send us a $100 support pack, we can spend an hour and dig up this code.
Hopefully, this gave you more ideas. If not, please reply and I'll try again. :)