title: Save Record with INSERTs - SAVE and 1 INSERT not working but rest work fine
body: <p>I'm attempting to create or save a record, and if the associated record exists within a secondary table, it only saves/updates the record on the form.  The INSERT statements work just fine, but I suck at referencing forms/subforms and I have a feeling it has something to do with these.  </p>
  
  <pre><code>Private Sub cmdSave_Click()
      On Error GoTo cmdSave_Click_Err
  
  DoCmd.RunCommand acCmdSaveRecord
  
  If DCount("*", "[tblRegSR]", "[WorkOrderID] = " &amp; [Forms]![frmWelcome]![sfrmWorkOrders].Form![txtID]) &gt; 0 Then
      DoCmd.GoToRecord , "", acNewRec
      Me.lstWorkOrders.Requery
      Me.lstWorkOrders.Value = ""
      Me.txtComments.Value = ""
      MsgBox "Save Completed"
  Else
      DoCmd.SetWarnings True
      DoCmd.OpenQuery "qryInsertSR"
      RunSQL "INSERT INTO tblFirstSR (ServiceRecordID) SELECT Max(ID) FROM tblRegSR"
      RunSQL "INSERT INTO tblSecondSR (ServiceRecordID) SELECT Max(ID) FROM tblRegSR"
      RunSQL "INSERT INTO tblInflatorSR (ServiceRecordID) SELECT Max(ID) FROM tblRegSR"
      RunSQL "INSERT INTO tblHPSPGSR (ServiceRecordID) SELECT Max(ID) FROM tblRegSR"
      RunSQL "INSERT INTO tblOctoSR (ServiceRecordID) SELECT Max(ID) FROM tblRegSR"
      RunSQL "INSERT INTO tblComputerSR (ServiceRecordID) SELECT Max(ID) FROM tblRegSR"
      DoCmd.GoToRecord , "", acNewRec
      Me.lstWorkOrders.Requery
      Me.lstWorkOrders.Value = ""
      Me.txtComments.Value = ""
      MsgBox "Sub Tables Injected"
  End If
  
  
  cmdSave_Click_Exit:
      Exit Sub
  
  cmdSave_Click_Err:
      MsgBox Error$
      Resume cmdSave_Click_Exit
  
  End Sub
  </code></pre>
  
  <p>I expect the process to check whether a record exists in <code>tblRegSR</code> that has a relationship to <code>tblWorkOrders</code> and the record matches the appropriate linked field (<code>[WorkOrderID]</code> in <code>tblRegSR</code> matches to <code>[ID]</code> in <code>tblWorkOrders</code>).  If the associated record does not exist in <code>tblRegSR</code> then create it along with the child tables (<code>tblFirstSR</code> and so on).  <br><br>
  Additionally, it's just not updating/saving the original record in <code>DoCmd.RunCommand acCmdSaveRecord</code><br> So I'm not entirely sure where it's causing problems.  It's not INSERT'ing into <code>tblWorkOrders</code> or <code>tblRegSR</code> but it is INSERT'ing into all other tables.  I'm sure once I figure the other two INSERTs out it'll the <code>IF</code> statement will work fine...I hope...</p>
  
  <p><strong>EDIT BELOW:</strong><br>
  Here are a couple screenshots of the data types:<br>
  <a href="https://i.stack.imgur.com/NSRzo.png" rel="nofollow noreferrer">tblWorkOrders Data Type</a><br>
  <a href="https://i.stack.imgur.com/hbcn9.png" rel="nofollow noreferrer">tblRegSR Data Type</a><br>
  <a href="https://i.stack.imgur.com/DTnDj.png" rel="nofollow noreferrer">Child Table Data Type</a><br>
  <a href="https://i.stack.imgur.com/MBAD0.png" rel="nofollow noreferrer">Picture of my table Relationships</a><br>
  <br>
  As for the count, I assume it's working because it's always completing the <code>ELSE</code> statement where it <code>INSERT</code> the rows into the child tables (<code>tblFirstSR</code>, etc.).  However, it is NOT INSERT'ing into <code>tblRegSR</code>, nor is it saving the record on the form (which is in <code>tblWorkOrders</code>).  Hopefully this answers your questions @Nathan_Sav - thank you!<br><br></p>
  
  <p><strong>EDIT TWO:</strong><br>
  Here is an image of the Validation Rule Violation: <br>
  <a href="https://i.stack.imgur.com/4V0J8.png" rel="nofollow noreferrer">Validation Rule Violation</a><br><br></p>
  
  <p><strong>EDIT THREE:</strong><br>
  I decided to just share the entire database.  Here is a link.<a href="https://drive.google.com/drive/folders/1_T-G9fyYQYjH3-YBe4PXhbBDTKNmY3ce" rel="nofollow noreferrer">Work Order Database</a> <br><br></p>
  
  <p><strong>EDIT FOUR (10 Jan 19):</strong><br>
  Here is the new code I'm using along with the code I'm using in my append query <code>qryInsertSR</code><br>
  <br>
  In <code>qryInsertSR</code> this is the SQL I'm using:<br> 
  <code>INSERT INTO tblRegSR (WorkOrderID, CustomerID) 
  VALUES (Forms![frmWelcome]![sfrmWorkOrders].Form![txtID], 
          Forms![frmWelcome]![sfrmWorkOrders].Form![Customer])</code></p>
  
  <p>Also, I've updated the code snippet above to reflect any changes I've made.<br><br></p>
  
  <p><strong>EDIT FIVE (11 Jan 19):</strong><br>
  Here's an image of my object browser showing everything in the database.  Including sfrmWorkOrders.  <br><a href="https://i.stack.imgur.com/zyHjO.png" rel="nofollow noreferrer">HERE</a></p>