Could be a variety of reasons.
You didn't mention which driver you are using. I'm assuming TPS?
So, you open this Form which essentially inserts a record into a parent table.
Also, on this same form a user can upload a file which creates a child record of aforementioned parent table.
I'm assuming this can all be done before the user clicks the "Save/Insert."
My friend, you have a Key field that is not being primed correctly, likely in the child table.
If it's a TPS table, if you open the table in TopScan, do you see empty key fields in that child table? I bet you will.
That's my guess. Bruce may say I'm wrong, and I could be, but I that's what I think.
See ya,
Don