Access 2007: Unexpected error (40230)
Asked Answered
L

1

8

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

Lunulate answered 30/5, 2013 at 22:44 Comment(3)
Another thing you can try (but not sure that it will help in your case..) - to import your form to the new empty DB and try observe the code in that new DBAbstriction
@Abstriction I tried that, I can import tables, queries but when try importing forms, it is disabledLunulate
I just had the same error code under Microsoft Word 2010 (c), and the same answer helped me. Thanks @vietnamese !Epa
S
18

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!

Sarnen answered 19/8, 2013 at 15:39 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.