title: How to remove an orphan code-behind module of a form created due to a bug in MS Access
body: <p>This took me a while to figure out the solution and I couldn't find anything on the web about it, so I share it here. Here is the problem (bug):</p>
  
  <p>In MS Access (2013 and presumably previous versions) when you create a new form, and add some VBA code behind it before saving the form and giving it a name, sometimes when things get messy, the name of the code-behind module does not update to reflect the new name, causing a disconnected form and VBA code.</p>
  
  <p>For example you create a new form that will temporarily be named <code>Form1</code>. You set its <code>Has Module</code> property to <code>Yes</code> which creates a <code>Form_Form1</code> module in <code>Microsoft Access Class Objects</code>. Then you mess with other things before remembering to save the form, giving it the name <code>MyForm</code> and some time later you  face this error:</p>
  
  <blockquote>
    <p>The form name 'Form1' is misspelled or refers to a form that doesn't exist.</p>
  </blockquote>
  
  <p>The <code>Form_Form1</code> module has not been renamed and remains there even if you delete <code>MyForm</code>.</p>
  
  <p>I tried creating a new form, saving it as <code>Form1</code> and then setting its <code>Has Module</code> property to <code>Yes</code> but unfortunately this last step gives gives an error.</p>