No worries, it looks like I've stumped the great minds here yet again.
I got the code from Patricks book which I think is available somewhere on this site. It's called Developing Solutions with Infopath and is a great read.
Place this in an onload procedure (it's in VB)
If Not thisXDocument.IsNew Then
Dim Submit As DAVAdapter
Submit = thisXDocument.DataAdapters.Item("Main submit")
If thisXDocument.URI.StartsWith(Submit.FolderURL) Then
thisFilename = thisXDocument.URI.Substring(Submit.FolderURL.Length)
End If
In order for it to work you will need to declare thisFilename as a public variable
To call it onSubmit,
Dim Submit As DAVAdapter
Submit = thisXDocument.DataAdapters.Item("Main submit")
If thisFilename Is Nothing Then
thisFilename = Submit.FileName
End If
Submit.Submit()
e.ReturnStatus = True
For this portion to work your submit data connection must be named "Main submit" and it is case sensitive. Hope this helps!