Why is my VBA for MS Access Buggy?

2019-03-26 13:01发布

This is kind of a vague question and hard to explain. I'm trying to code my access database, but the VBA portion is really annoying me. Whenever I type something and hit space, it will automatically redo that space and put me back up against the previous word i was typing. Also, Intellisense will come up for a split second, flicker and go away, and revert my cursor to the text that I was just typing. This results in me constantly typing things in places where they shouldn't be and a lack of spaces between elements of my code. Does anyone know why this would be occuring? The database I'm using was created in Access 2007, but I am developing it in 2010. At the top it says Microsoft Access 2007-2010.

Thanks for your help.

1条回答
Juvenile、少年°
2楼-- · 2019-03-26 13:50

The most likely cause is that you have a form open with an active timer event.

What is happening is that as you are editing your code, there is code running at some regular interval. Each time that other code runs, the just-in-time compiler for VBA runs.

Normally when you are writing code, this real-time compilation happens whenever you move from one line of code to another: compile errors are raised, trailing white space is trimmed, etc.

However, in your case you have some piece of code that is running. Before it can run, the compiler must run. And it does the same things it normally does. Most annoyingly, it trims trailing white space from your line.


The solution is to close the form with the active timer event, or set the timer interval to 0 while you are editing your code.

查看更多
登录 后发表回答