title: Keep getting error trying to save a record in ms access VBA
body: <p>I kept getting an error with <code>Me.Dirty = False</code> or <code>DoCmd.RunCommand acCmdSaveRecord</code>.  With <code>Me.Dirty = False</code> it was 'invalid property', and with <code>docmd</code> it was error 2501.</p>
  
  <p>After some experimenting I tried a <code>Me.Refresh</code> command before the save command, and the error stopped occurring.</p>
  
  <p>I'm just sharing this in case anyone else gets a sticky save error (especially if it goes away after they press f5 in the debugger) - just put a <code>Me.Refresh</code> command before the save and it might help you out.</p>
  
  <p>Also if anyone knows why a refresh before the save fixes it, I'd be interested.</p>
  
  <p><strong>PS:</strong> - History - after I noticed that if I pressed F5 in the debugger after I got the error, then the record actually did get saved on the retry with no further errors.</p>
  
  <p>Then I tried putting a dialog box up for the user in an on error handler with a resume to retry the save, and after they clicked OK the record saved and the error did not recur.</p>
  
  <p>That's how I guessed a refresh might help, since the dialog forced some kind of refresh.  It was a kind of wild guess, but it worked.</p>