title: ms-access DoCmd.RunSQL statement can't add record due to key violation but no records are in table
body: <p>I have been running this query for a about 3 weeks now and all of a sudden it stopped working. This is the error I get:</p>
  
  <p><a href="https://i.stack.imgur.com/KECJT.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/KECJT.png" alt="enter image description here"></a></p>
  
  <p>My table is completely empty. Here is the code for the INSERT INTO statement:</p>
  
  <pre><code>SQL$ = ""
  SQL$ = SQL$ &amp; " INSERT INTO table1"
  SQL$ = SQL$ &amp; " VALUES ('test', 1, '1-1', #01/01/2001#, 1000, 'testing', 'example', 1, 2, 30);
  
  DoCmd.RunSQL SQL$
  </code></pre>
  
  <p>There is nothing that should be violating the primary key value since there are no records existing. Is there another way to violate the primary key or is this an access issue?</p>
  
  <p>This is the table design:</p>
  
  <p><a href="https://i.stack.imgur.com/l36rg.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/l36rg.png" alt="enter image description here"></a></p>
  
  <p>Ignore the bad field names, I had to change them temporarily so I could post here. </p>
  
  <p>I even tried to run this as an Access query outside of VBA:</p>
  
  <p><code>SELECT * FROM table1</code></p>
  
  <p>and it returned nothing.</p>
  
  <p><strong>UPDATE:</strong></p>
  
  <p>This is interesting. So table1 is in a 1 to many relationship, the vNum being the many in table1 as stated earlier. On the 1 side, call the table "oTable", it already had a list of vNum's that I imported from a different database. I recently created a new record in oTable with the vNum called "vTester". In my form for table1 that is generating the above SQL insert statement, I can choose whichever vNum I want from a combobox. The user CANNOT choose one that doesn't exist. In my form I picked "vTester" and got the above errors. When I chose one of the imported vNum's however, the SQL command worked. Any ideas?</p>