如何启用 MS Access VBA 调试?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7532992/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 11:56:45  来源:igfitidea点击:

How to enable MS Access VBA debugging?

ms-accessvba

提问by Bill Software Engineer

This is really annoying. In MS Access VBA, there should be linebreak and debugging, however it always go through my code without hitting any of my breaks. Is there somewhere where I need to enable it first? I have the following option:

这真的很烦人。在 MS Access VBA 中,应该有换行和调试,但是它总是通过我的代码而不会遇到任何中断。有什么地方我需要先启用它吗?我有以下选择:

Option Compare Database
Option Explicit

回答by Zico

I did face this issues in MS Access 2010.

我确实在MS Access 2010.

All you need to do is uncheck "Use Access Special Keys"

您需要做的就是取消选中“使用访问特殊键

Option available under Access Main Menu .. do the following:

访问主菜单下可用的选项 .. 执行以下操作:

Select File -> Options -> Select General Database 

Check or uncheck "Use Access Special Keys"

选中或取消选中“使用访问特殊键

Close and Open file and you are done.

关闭并打开文件,你就完成了。

回答by David-W-Fenton

In VBE options, you need to make sure that the choices on the GENERAL tab are chosen correctly. I recommend these settings:

在 VBE 选项中,您需要确保正确选择了 GENERAL 选项卡上的选项。我推荐这些设置:

  • BREAK IN CLASS MODULE (not BREAK ON ALL ERRORS, because the latter will not show you which line in a class module has caused the problem)

  • COMPILE ON DEMAND turned OFF.

  • BREAK IN CLASS MODULE(不是 BREAK ON ALL ERRORS,因为后者不会显示类模块中的哪一行导致了问题)

  • 按需编译关闭。

When you're coding, I recommend turning OFF AUTO SYNTAX CHECK on the EDITOR tab, because I can depend on the code turning red to tell me that it doesn't compile, without the interruption of a dialog popping up.

当您编码时,我建议关闭 EDITOR 选项卡上的 AUTO SYNTAX CHECK,因为我可以依靠代码变红来告诉我它没有编译,而不会中断弹出对话框。

回答by Philippe Grondier

I am sure you'd love this question. Check the answers. Mineis quite complete. erl and MZ-tools are the keys to "real" debugging in MS-Access

我相信你会喜欢这个问题。检查答案。我的已经很齐全了。erl 和 MZ-tools 是 MS-Access 中“真正”调试的关键

回答by Christian Specht

You can also write Stopin your code to cause the debugger to break.

您还可以写入Stop代码以导致调试器中断。