Re: Code window Crashes!



I wouldn't expect a crash from this, but do you have a form open that has a timer event running? If so, everytime the timer event is tripped the focus moves from the VBA window to the open form.

First experiment is to try to launch your database while holding down the shift key. Then switch to VBA and try to enter something. If the crashing stops, you know the culprit and will have to find the form that is loading and disable it while you are working in VBA.

You might, at this point, have a corrupted database (or at least corrupted VBA), take a look at the following

From: Allen Browne
Okay, so something has gone haywire with this database. Suggestions to recover it:

1. Make a backup copy of the mdb file, without overwriting any existing backups, in case something goes wrong.

2. Uncheck the boxes under:
Tools | Options | General | Name AutoCorrect Explanation of why:
http://allenbrowne.com/bug-03.html

3. Compact the database to get rid of this junk:
Tools | Database Utilities | Compact

4. If the tables are attached, open the data file, and repeat steps 1 - 3 for that file as well.

5. Close Access. Decompile the database by entering something like this at the command prompt while Access is not running. It is all one line, and include the quotes:
"c:\Program Files\Microsoft office\office\msaccess.exe" /decompile
"c:\MyPath\MyDatabase.mdb"

6. Open Access, and compact again.

7. Open a code window.
Choose References from the Tools menu.
Uncheck any references you do not need.
For a list of the ones you typically need in your version of Access, see:
http://allenbrowne.com/ser-38.html

8. Still in the code window, choose Compile from the Debug menu.
Fix any errors, and repeat until it compiles okay.

9. Compact again.

At this point, you should have a database where the name-autocorrect errors are gone, the indexes are repaired, inconsistencies between the text- and compiled-versions of the code are fixed, and reference ambiguities are resolved.

If it is still a problem, the next step would be to get Access to rebuild the database for you. Follow the steps for the first symptom in this article:
Recovering from Corruption
at:
http://allenbrowne.com/ser-47.html

'====================================================
John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
'====================================================


Ambyr via AccessMonster.com wrote:
I am pulling my hair out on this one...
I've seen similar posts, but none of the solutions fixed my issue.

My database works perfectly, calls all macros, code, etc with no problems.
The only issue I have is when I am adding or updating the VBA code, I get a
fatal crash. I type "Dim MPart as " and get a crash.
I type "me." and get a crash.
However, type me.Mpart = me.PicMonth in word, and then paste it into the VBA,
all works well, and the code window will even change the lower case me's to
proper Me...

I've tried uninstalling and reinstalling, i've tried updating and getting all
hotfixes and patches/service packs; to no avail! it is not specific to this
database, i just created a brand new one, with only one table (and only 2
fields), made the form, switched to VBA window, typed me. and watched it
crash, again.

Please help, this is driving me out of my mind!

.



Relevant Pages

  • Re: Incompatibility between Access 2003 and Access 2002
    ... Try opening another database, such as Northwind. ... Does that crash also as soon as you open a code window? ... I don't think the problem is in the startup form. ...
    (microsoft.public.access.modulesdaovba)
  • Code window Crashes!
    ... My database works perfectly, calls all macros, code, etc with no problems. ... I type "Dim MPart as " and get a crash. ... However, type me.Mpart = me.PicMonth in word, and then paste it into the VBA, ... and the code window will even change the lower case me's to ...
    (microsoft.public.access.modulesdaovba)
  • Re: Merging content from access
    ... My hunch at the moment is that this is a problem in my access query. ... I agree with you that Word VBA is a more elegent solution. ... The other field-based technique requires you to have a "parent" table as ... the mail merge data source and a child table inserted using a DATABASE ...
    (microsoft.public.word.docmanagement)
  • Re: Possible Project Bug: All Projects in Database are Deleted upon Save
    ... best practices and Project VBA ... > Only Project1 is saved into the database. ... >> prompts with Append or overwrite message. ... >> For Microsoft Project companion projects, ...
    (microsoft.public.project.vba)
  • Re: What happens when data in control is updated
    ... When I developed my concept database file I tended to look at what ... changes expected appearing on the form itself) and not going through the VBA ... > if the primary key field is Text data type, rather than numeric, the ... >>> make sure that a requery is necessary to achieve whatever your aim is. ...
    (microsoft.public.access.formscoding)