Code window Crashes!

  • Thread starter Ambyr via AccessMonster.com
  • Start date
A

Ambyr via AccessMonster.com

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!
 
J

John Spencer

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
'====================================================
 
J

John W. Vinson

I type "Dim MPart as " and get a crash.
I type "me." and get a crash.

I wouldn't expect a *crash* but there is no expression

Dim MPart As Me.anything

that will be valid. The expression after As needs to be some valid datatype
(Integer, or Object, or String, or any of dozens of other datatypes) - not the
name of an object on the form.

Are you intending to type As Me.something?

If so, what is something and what are you intending to accomplish?
 
P

pyxi_styx via AccessMonster.com

Unfortunately, this did not fix the issue. I do not have a timer event on any
forms, held shift with no non-crash difference, and it is not just this one
DB, it's every single one... more an issue with Access than with the DB, it
seems.

I really appreciate your response, any further suggestions?

Thanks
Ambyr

John said:
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
'====================================================
I am pulling my hair out on this one...
I've seen similar posts, but none of the solutions fixed my issue.
[quoted text clipped - 15 lines]
Please help, this is driving me out of my mind!
 
P

pyxi_styx via AccessMonster.com

What I was saying is that as soon as I type the word as in the first example,
or the dot operator in the second example, that is where it crashes. i.e., I
try to enter the line of code that is supposed to Dim MPart as String, but
before I type String, it crashes. Same with trying to type
me.InvDay = me.DPart.Column(1)
I get the crash just as I type that first dot
 
J

John W. Vinson

What I was saying is that as soon as I type the word as in the first example,
or the dot operator in the second example, that is where it crashes. i.e., I
try to enter the line of code that is supposed to Dim MPart as String, but
before I type String, it crashes. Same with trying to type
me.InvDay = me.DPart.Column(1)

Does this happen with all databases or just this one? SOMETHING is massivly
corrupt - either your database's VBA project, or your installation of Access.
 
P

pyxi_styx via AccessMonster.com

Does on all databases, however, I have found a means to fix this problem.
Run -> Regsvr32.exe "C:\Program Files\Common Files\system\ado\Msado15.dll"
and Run ->Regsvr32.exe "C:\Program Files\Common Files\Microsoft Shared\DAO\
Dao360.dll"

As soon as I ran these commands, everything was peachy.
 
Top