You’re getting this error because you’re trying to add/update a row to table2
that does not have a valid value for the UserID
field based on the values currently stored in table1
. If you post some more code I can help you diagnose the specific cause.