db is Crashing

A

AWM

I have a Access 2003 db. One of my forms, when closed, turns the
screen to grey (in the outline of the form). In essence, when closed,
it's freezing the db. I cannot figure out why this is happening. It
only happens on one form and only when you try to close the form using
the "X" in the right-hand corner.

Does anyone know a root cause for this effect? Bad VB, or other
reason?

Thanks.
 
A

Allen Browne

The cause is probably a corruption, and this sequence should get you going
again.

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

2. Compact the database:
Tools | Database Utilities | Compact

3. Close the database, and make a backup copy.

4. Decompile 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"

5. Compact again.

6. If the problem form has a subform:
a) Open the form in design view.
b) Right-click the subform control, and choose Properties.
c) Locate the LinkChildFields property (Data tab).
d) If the property refers to a field in the subform that does not have a
control on the subform, delete the entries for the LinkMasterFields and
LinkChildFields properties.
e) Add a text box to the subform, bound to this field.
f) Save.
g) Close the form.
h) Open the form again, and set the LinkMasterFields and LinkChildFields
again. The LinkChildFields now contains the name of the text box you just
added to the subform.

7. Press Ctr+G to open the Immediate window.
Choose References from the Tools menu.
Remove any references you do not need.
If you are not sure what you need, see:
http://allenbrowne.com/ser-38.html

8. Still in the Immediate window, choose Compile from the Debug menu, to
check it compiles.

Hopefully everything is okay at this point.

If not, the next step is to create a new (blank) mdb, turn off Name
AutoCorrect, set your references, and import everything else except the
problem form. You could then recreate just this one form from scracth, or
import it from an old back up that does not have the problem. You might even
be able to use SaveAsText to export the bad form, and LoadFromText to import
it into the new database.

More general help on solving corruptions:
http://allenbrowne.com/ser-47.html
 
D

Deb in Nashville

If you are trying to display a form and do not have any records fo it to
display, you will get a blank screen, but Access will not be frozen. Make
sure you have at least a dummy record that will be displayed on the form and
see if this happens again.
 
Top