When I type in the Visual Basic editor it always goes crazy!

Lateral

Registered User.
Local time
Today, 14:25
Joined
Aug 28, 2013
Messages
388
Hi guys

This has been driving me nuts for sometime....

When I type in the VB editor, it seems to what to always auto correct and always gets it wrong so that when I want to type something like a comment:

'This is a test comment to show you what I mean

It will type the following:

Thisisa testcommenttoshow youwhatImean'''

Is there an option somewhere that I can check?

Thanks
Greg
 
Wow! The only autocorrect I'm aware of is name autocorrect and I've never seen it do anything like that. Do you have any Add-Ins.
 
also, just to be clear, do you mean the vba editor (per access/excel/word etc) or the vb editor per visual studio

Also, are you using a wireless keyboard? - I do and if it drifts across the desk too far from the receiver (usb port)a s I excitedly type away, or the batteries are running low I get the same behaviour.
 
Hi CJ,

I'm am using Access 2007 and it is the Access 2007 VBA Editor.

I am also using a wireless keyboard and whilst I do also occasionally experience the same issue you mentioned., the issue with the VBA editor is different.

What is seems to be doing is removing "spaces" between words as a type. If for example, I start to type 3 seperate words and I pause a few seconds between the 1st and 2nd word, it will remove the space between the 1st and 2nd word......

I hope the above provides come more clarity.

Cheers
Greg
 
I have an idle timer setup to automatically close the app. If I close the offending form, the VBA editor issue doesn't happen anymore.....
In reading down the thread I was going to ask about a Timer event...this is one of the known problems in using them, another being the strange, odd and curious things that can happen when you have the Timer running on a given Form and have multiple Forms open at the same time!

Linq ;0)>
 
The editor and the VBA code are running in the same process. If you set up a Timer event like

Code:
Private Sub Form_Timer()

Dim i As Long
For i = 0 To 1000000000
Next i

End Sub

The editor will just stop (won't display typed characters) while that loop is being executed. The question is why does this cause spaces to be dropped from the keyboard buffer.
 
I notice something else. Without any timer if you type something in the editor and stop after typing some spaces, move your cursor off the line you are typing and back, the spaces you typed are gone. I believe this is the normal intended behavior. It seems that when the Timer event fires it has the same effect.
 
Old thread, but in case someone is searching and runs across this, there are too different issues being described:
  • If you have a timer running, the vb editor will drop spaces that you typed while the timer was active. So instead of "If X = 3 Then" you end up with "IfX=3Then" (and probably a prompt about a syntax error.
  • The VB editor by default clear out UNNEEDED spaces when you move to a different line. So if you type <MsgBox ("There<3 spaces>are " & NumUsers &<20 spaces>" accessing the database currently"> it will show <MsgBox ("There<3 spaces>are " & NumUsers & <one space>" accessing the database currently">
(The forum software also deletes unneeded spaces, so it was difficult to show.
 
Hi again CJ,

I did some more Googling and found the following that seems to be the cause of the issue I'm seeing. I have an idle timer setup to automatically close the app. If I close the offending form, the VBA editor issue doesn't happen anymore.....

http://www.pcreview.co.uk/threads/strange-vb-editor-behavior.1633543/
You should NEVER be running code while editing code - that's asking for corruption and getting it pretty often!

You should never:

1) run code without compiling it
2) edit code while it's running
3) edit code while in break mode

that's like trying to fix a car while flying down the highway!
 
You should NEVER be running code while editing code - that's asking for corruption and getting it pretty often!

You should never:

1) run code without compiling it
2) edit code while it's running
3) edit code while in break mode

that's like trying to fix a car while flying down the highway!

Just a minor comment: #1 actually doesn't ever happen but ONLY because if you have uncompiled code and start running it, Access stops for long enough to compile the module. IF you have several uncompiled modules, they compile as needed/referenced.
 
Simple routine to turn timers off:
Code:
Public Sub SilenceTimers()
' Must be run to enable typing in the VBE - space bar is cancelled otherwise - 2023-Sep-7 - MB.
' https://answers.microsoft.com/en-us/msoffice/forum/all/can-not-coding-vba-in-microsoft-access-when-typing/11e7199d-cbc3-4584-b99f-5b6c4f69b272
Dim f As Form
For Each f In Forms
  f.TimerInterval = 0
Next f
End Sub
 
@Pat Hartman - I didn't catch all of the nuances of the code you posted. My code turns the timers off when I am developing code. When I want to test with the timers on, I close and re-open the database.

I will probably test and possibly adopt your code instead, though.
 
@Pat Hartman - I didn't catch all of the nuances of the code you posted. My code turns the timers off when I am developing code. When I want to test with the timers on, I close and re-open the database.

I will probably test and possibly adopt your code instead, though.
How do you know what the timers were set before though?
 

Users who are viewing this thread

Back
Top Bottom