Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is my VBA for MS Access Buggy?

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.

like image 967
Scotch Avatar asked Jun 05 '12 15:06

Scotch


People also ask

Can you use VBA in Access?

Like macros, VBA lets you add automation and other functionality to your Access application. You can extend VBA by using third-party controls, and you can write your own functions and procedures for your own specific needs.

How do I start VBA in Access?

How to open the VBA environment. You can access the VBA environment in Access 2010 by opening up the Microsoft Visual Basic window. The quickest way to do this is by pressing Alt + F11 while your Access database file is open. This is an example of what the Microsoft Visual Basic window looks like.

How do I make my Access database look like a program?

Specify the default form in Access Options Click the File tab, and then under Help, click Options. Click Current Database. Under Application Options, in the Display Form list, select the form that you want to display when the database starts. Click OK, and then close and reopen the database to display the startup form.


1 Answers

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.

like image 156
mwolfe02 Avatar answered Oct 05 '22 04:10

mwolfe02