title: Access 2007: Unexpected error (40230)
body: <p>I am getting an Unexpected error (40230) when trying to access VBA code for the form I have in Access 2007.</p>
  
  <p>I tried decompiling, which is how I found out the project is corrupt. I received the following message when I decompiled:</p>
  
  <pre><code>"The Visual Basic for Applications project in the database is corrupt"
  </code></pre>
  
  <p>I tried to save the VBA code to a text file the following way:</p>
  
  <pre><code>Application.SaveAsText acForm, "App_Form", "C:\Users\jck112\Documents\Module1.txt"
  </code></pre>
  
  <p>But I get following error:</p>
  
  <pre><code>Run-time error '3021'
  No current record.
  </code></pre>
  
  <p>I also tried importing the form to a new DB, but it didnt allow me. It allows me to import tables, queries from the same DB the form is in, but wont let me select the form, it is disabled.</p>
  
  <p>Also, I have both .accdb and .accde files.</p>
  
  <p><strong>Note: The form functions perfectly fine when used. Button clicks do as expected, so the code behind these buttons work. But I need to make some enhancements to the code.</strong></p>
  
  <p>Is there any way I can retrieve my VBA code? or repair my database?</p>
  
  <p>Any help is much much appreciated</p>