Hilary,
I think I have found a solution thanks to your expert guidance. When I unchecked the "Include data for the active form only" checkbox in the data connection for retrieving the ID from the form Library, I found that it just returns the first ID in the library. If this checkbox is checked, it doesn't return any value. Obviously it is of no use to me if the ID returned all the time is the first item in the list, so as a workaround, when I'm setting the value for referral on the form I used the function max(ID) and this returns the highest/latest/current value of the submitted item. I cannot think of an instance whereby this logic might fail, but please let me know if I'm missing something obvious.
In addition, I also discovered that I only need to submit the form one time to the library.
Many thanks for your patience and help with this issue. It is very much appreciated.
Padraic