why is my parent table being updated?

perry _59 21 Reputation points
2022-01-31T17:12:05.433+00:00

I have two tables in an access database. One called partDefinitions which contains definitions of electrical parts. Another table called parts which stores part references which point to one of the definitions in the partDefinitions table. The partDefinitions table has an autoincrementing column called PartDefID which is the primary key. The parts table has an autoincrementing column called PartRefID which is the primary key. The part table also has a column called PartDefID which is a foreign key to the PartDefinitions table. There is NO cascading options assigned to that foreign key.
That being said, I have a line of code in my program for "swapping" parts in my parts table which acts as a BOM. The only thing this line of code does is change the PartDefID field in the parts table for a particular row which should simply have that part point to a new definition in the partDefinitions table. It does do this but it is also changing fields in the partDefinitions table which it should NOT do. Here is the line of code that I am using to update the Parts table:

sql = "Update Parts Set PartDefID = " & _PartDefIDreplacement & " WHERE ComponentID = '" & _vsoShape.UniqueID(1) & "'"  

below are some screen grabs which I hope will illustrate the problem
Can someone please tell me what is going on here?
Thanks

part definitions table before running code:
169919-before.png
Part definitions table after running code:
169920-after.png
Parts table before running code:
169991-before2.png
Parts table after running code:
169954-after2.png

Access Development
Access Development
Access: A family of Microsoft relational database management systems designed for ease of use.Development: The process of researching, productizing, and refining new or existing technologies.
832 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. perry _59 21 Reputation points
    2022-01-31T19:19:02.577+00:00

    Please disregard the question. I found the culprit, another event procedure was kicking in

    0 comments No comments