Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Weird Behavior in VBA Modules - What's Going On?

Status
Not open for further replies.

tubbers

Technical User
Jun 23, 2004
198
0
0
US
I'm using MS Access 2003 on an XP machine with forms and tables. The forms have modules associated with them.

When I'm in the VBA window and writing code, it seems to be exhibiting some very weird behavior.

If it's the first time I'm in the module after opening the database or compacting, it is fine. However, if I have an error and have to debug the module or if I've worked through the form and switched to design mode then viewed the module that is when it starts getting weird.

It's hard to explain but I'll do my best.

The title bar where it says "Microsoft Visual Basic" & the database name then the form name seems to twitch. It looks like only the form name changes like it is very quickly switching between the form I'm editing to something else.

In addition to this twitching, when I'm typing code the cursor jumps forward and backward before I can get two letters typed, if I put a space between words, the cursor jumps back to the end of the previous word so that they are joined and not separated.

What it boils down to is I can't do anything in the VBA window until I compact & repair the database. Then the next time I go to work in the VBA module it's fine then after the first use it does it again.

Does anyone recognize this problem and maybe have a solution?
 
Don't you have some Timer event procedures still running when you're in the VBE ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
I do have a clock that is displayed. However, even if I press the "stop" or reset button it still continues to "twitch".

Shouldn't that stop all running event procedures? Or is there some sort of code that I should insert that would stop it?

My VBA error handling skills aren't that great.
 
It also crashes the database if I try to Compile the code.
 
You've got a corrupt project on your hands.

Randall Vollen
National City Bank Corp.
 
Did you say you DO have a timer running in your program? Not some clock running outside of Access but within Access.
 
Yes, it's a clock/timer on the form

Code:
Private Sub Form_Timer()

    'Display the current date and time on form
    Me.Detail_lblClock.Caption = Format(Now, "dddd, mmm d yyyy, hh:mm:ss AMPM")
    
End Sub

I've started rebuilding the database as I assume that's the only way to fix the corruption.
 
You need to have a way to release the event so that it is not continuously running. Have a look at Do Events. It should allow you to yield other processes.

Tom

Born once die twice; born twice die once.
 
Thanks, I will have a look and see what I can learn.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top