What's happened to my Database?

K

KT

I am working on a database. It's been fine and one day when I opened it, an
error message popped up said "Module not found" whenever I clicked on a
button or selected something from a combo box.

It actually has happened couple times already. No matter which button i
clicked on (that worked perfectly fine couple minutes ago), I got this error
message. When the VB window opened up, it just froze and could not pull up
any code from that form at all.

I fixed it by exporting all the tables, queries..etc and starting a
database, but I would have to build all the buttons (that are supposed
to tie to modules) all over. Because whenever I tried to build a new button
on the existing database, it would say "Subscript out of range" and would
not let me finish.

This is the 4th time this is happening now....It is so frustrating..Any help
will be appreciated!

Kanley
 
A

Allen Browne

Hi Kanley

Can certainly understand your frustration, and it makes sense to post a
message asking how to prevent this recurring.

Take a look at this article:
Preventing Corruption
at:
http://members.iinet.net.au/~allenbrowne/ser-25.html
It addresses several crucial issues.

The mesage you refer to can also occur if one of the wizards or references
is not registered correctly. For references, see:
http://members.iinet.net.au/~allenbrowne/ser-38.html
For wizards see:
http://support.microsoft.com/default.aspx?scid=kb;en-us;164240

If these things don't help, try decompiling a copy of 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

'69 Camaro

Hi, Kanley.
when I opened it, an
error message popped up said "Module not found" whenever I clicked on a
button or selected something from a combo box.
When the VB window opened up, it just froze and could not pull up
any code from that form at all.
I fixed it by exporting all the tables, queries..etc
it would say "Subscript out of range" and would
not let me finish.

These symptoms sound familiar. By chance, are you:

1.) Using Access 2000; and
2.) Office 2000 SP-3 is not installed; and
3.) An application from Office XP or 2003 is installed; and
4.) You didn't compile the code before closing the application or before
Access crashed?

HTH.

Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips.

(Please remove ZERO_SPAM from my reply E-mail address, so that a message
will be forwarded to me.)
 
K

KT

Let's see...

I am using Access 2003, I dont think I have installed SP-3 (should I?),
Office XP was once installed..but i think it's replaced by 2003 now. I dont
know about compiling the code before closing...cos I just wizard to build my
control, so maybe I didn't?

Would reinstalling Access help?
 
K

KT

thanks Allen, that helps, I will try decompiling the database..
I have been really careful about not shutting it down when it's loading
though..
so I dont know what's causing that..

i heard of similar situation from others, thought that's some sort of known
issue...and hoping for an instant 'fix' that would fix it..
:p i think i just need to face it.

Kanley
 
6

'69 Camaro

Hi, Kanley.
I am using Access 2003, I dont think I have installed SP-3 (should I?),

No. Office 2000 SP-3 should only be installed for Office 2000 (or Access
2000 if it's a stand-alone application). Access 2003 has SP-1 available,
though, which should be installed on your computer if you'd like to keep it
up to date.
I dont
know about compiling the code before closing...cos I just wizard to build my
control, so maybe I didn't?

Any time an Access Wizard automates the form by placing a button on it, code
is written in the module automatically, and the code _should_ be compiled
again. Open the VB Editor (press <ALT><F11> to open it), then select the
Debug menu -> Compile <DatabaseName>. If there are any compile errors, the
VB Editor will display the line of code where the error is located. Fix
this error, then recompile the code. Continue fixing any errors in the code
until there are no more errors during compiling. Only then is the code
"compiled."
Would reinstalling Access help?

If it's the problem I'm referring to, then not likely. But we haven't ruled
out anything yet.

If you don't have Access 2000 on your computer, then is this database file
on a network where anyone else can open it (or has ever opened it) with
Access 2000 under the other conditions I mentioned? It only takes one
computer with this configuration to corrupt the modules whenever a form,
report or module is imported or pasted into the database and the code isn't
compiled before quitting the application.

HTH.

Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips.

(Please remove ZERO_SPAM from my reply E-mail address, so that a message
will be forwarded to me.)
 
K

KT

Decompiling works!!!! Thanks a lot!!!! (can't be happier...)
What does that means though? Is that mean I didn't do something that I
should?
 
A

Allen Browne

Access maintains 2 copies of the code:
- the text version (what you read and edit), and
- the compiled version (the machine code that actually executes).

If these two become out of sync, you have a corruption. Decompile tells it
to throw away the compiled version. It will then create it again from the
text version. Unless the text version was the one that was bad (infrequent,
but does happen), you're now back in business.

As to what causes this, there are probably several causes, some that you
can't control. The major ones seem to be:

1. Modifying the objects in different versions of Access.
For example, if you modify the code in Access 2003, and then run it it
Access 2000 or vice versa, they are not binary compatible and so Access is
supposed to silently recompile for you. It's not perfect at this. Decompile
before switching versions if the code/objects have been modified.

2. Editing while code is running
If you edit the module behind a form while the form is open (not in design
view), Access creates a temp copy of the form and its module (so you can
revert to the saved copy). If you do this in break mode, there seems to be a
point at which it gets confused between the four copies of the code it is
now trying to juggle. To prevent this, don't edit in break mode, only if the
form is open in design view.

The other issues I'm aware of have been addressed in service packs, so are
not relevant if you are up to date with both your Office service pack and
also your JET 4 service pack.
 
B

Bas Cost Budde

2. Editing while code is running [may cause corruption]

Ooh, I'm so happy reading this. That does answer some of my wildest
questions.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top