title: How do I keep my auto generated number the same when a record is edited in MS Access?
body: <p>I have code behind my Save button that generates a Change Request Number upon the record being saved. So let's say:</p>
  
  <ol>
  <li>I create Change Request 97 and save it.  </li>
  <li>It writes to the table as Change Request Number 97.   </li>
  <li>When I go back in to Edit it and hit the edit button, after I make my changes it re-saves to the table. But it changes the Change Request Number to 98 and the 97 record is gone.</li>
  </ol>
  
  <p>Is there a way to edit the record and keep the same Change Request Number ? </p>
  
  <p>I have been trying to look up functions but I haven't coded anything in Access in a long time, I just need some help. </p>
  
  <pre><code>If Me.NewRecord = True Then
      Me.Change_Request_Number = Nz(DMax("[Change Request Number]", "Change Requests"), 94) + 1
  DoCmd.RunCommand acCmdSaveRecord
  </code></pre>