<p>I am getting the following error in an MS Access ADP when trying to add a record on a form linked to a MS SQL Server 2000 table:</p>

<blockquote>
  <p>Run-time error '31004':</p>
  
  <p>The value of an (AutoNumber) field
  cannot be retrived prior to being
  saved.</p>
  
  <p>Please save the record that contains
  the (AutoNumber) field prior to
  performing this action.
  note: <em>retrieved</em> is actually spelled wrong in the error.</p>
</blockquote>

<p>Does anyone know what this means?</p>

<p>I've done a web search and was only able to find the answer at a certain site that only experts have access to.</p>

[{'answer_id': 60012, 'author': 'busse', 'author_id': 5702, 'author_profile': 'https://Stackoverflow.com/users/5702', 'pm_score': 0, 'selected': False, 'text': "<p>Are you trying to assign the value of an Identity field to a variable or something else before you have saved the record?</p>\n\n<p>For whatever reason, your app is trying to read the value of the identity field before the record has been saved, which is what generates that identity field.  In other words, no value exists for the Autonumber field until the row is saved.</p>\n\n<p>I think we'd need to see more code or know more about the steps that lead up to this error to resolve it in more detail.</p>\n"}, {'answer_id': 63610, 'author': 'BIBD', 'author_id': 685, 'author_profile': 'https://Stackoverflow.com/users/685', 'pm_score': 3, 'selected': True, 'text': "<p>First of all, if you are going to look at experts-exchange - do it in FireFox, you'll see the unblocked answers at the bottom of the page.</p>\n\n<p>Second, do you have a subform on that form that's using the autonumber/key field on the master form? Do you require the data that's on that subform to be saved (i.e., having its own key) before the main form is saved. You could be into a deadlock of A and B requiring each other to be saved first.</p>\n\n<p>Other than that, you must somehow be accessing that autonumber field whenyou are saving it. The best I can suggest is to step through the code line by line.</p>\n"}, {'answer_id': 77334, 'author': 'Philippe Grondier', 'author_id': 11436, 'author_profile': 'https://Stackoverflow.com/users/11436', 'pm_score': 0, 'selected': False, 'text': "<p>You should have add some lines of code to show us how you're managing your data and what you are doing exactly. But I am suspecting an issue related to a recordset update. can you identify when the autonumber value is created? Is it available in a control on a form? Can you add a control to display this value to check how it is generated when adding a new record? Is the underlying recordset properly updated? Can you add something like me.recordset.update on some form events: I would try the OnCurrent one ... </p>\n"}]
['https://Stackoverflow.com/questions/59809', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2831/']