vba Access 2007:意外错误 (40230)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/16847059/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Access 2007: Unexpected error (40230)
提问by user793468
I am getting an Unexpected error (40230) when trying to access VBA code for the form I have in Access 2007.
尝试访问 Access 2007 中的表单的 VBA 代码时,出现意外错误 (40230)。
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:
我尝试通过以下方式将 VBA 代码保存到文本文件中:
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.
另外,我有 .accdb 和 .accde 文件。
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?
有什么办法可以检索我的 VBA 代码吗?或修复我的数据库?
Any help is much much appreciated
非常感谢任何帮助
回答by vietnamese
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),
按ALT+ F11,选择Tools
-> VBAProject Properties
,导航到Protection tab,
添加新密码,然后再次确认(如果需要新密码),
Otherwise simply put blank textbox, remove check from lock project for viewing, then save and close excel and reopen it! Give me a beer!
否则只需放置空白文本框,从锁定项目中删除检查以进行查看,然后保存并关闭excel并重新打开它!给我一杯啤酒!