I am getting an Unexpected error (40230) when trying to access VBA code for the form I have in Access 2007.
I tried decompiling, which is how I found out the project is corrupt. I received the following message when I decompiled:
"The Visual Basic for Applications project in the database is corrupt"
I tried to save the VBA code to a text file the following way:
Application.SaveAsText acForm, "App_Form", "C:\Users\jck112\Documents\Module1.txt"
But I get following error:
Run-time error '3021'
No current record.
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.
Also, I have both .accdb and .accde files.
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.
Is there any way I can retrieve my VBA code? or repair my database?
Any help is much much appreciated
Press ALT+F11, choose Tools
->VBAProject Properties
, navigate to the Protection tab,
add new password and then confirm it again(if you want new password),
Otherwise simply put blank textbox, remove check from lock project for viewing, then save and close excel and reopen it! Give me a beer!