Help Please!!! Corrupt Form: Crashes When Saving Changes?

T

Tirelle

Please Help Anyone>>> I have a Form in an application that I am working on
that works great. How ever I cannot make any changes to it (the form itself
nor the code in the module) with out it crashing the application. By crashing
i mean it want to compact and repair with out saving any changes. I can make
and save changes to any of the subforms but not the main form? I have tried
the basics... AutoCorrect, decompiling compactinf and debugging with No
success. Any suggestions are greatly appreciated.
Thank You
 
A

Allen Browne

First, make a backup of the MDB, so you get multiple attempts at fixing
this.

Are you able to open the code window, and get to the code for this bad form?
If so, copy the code out to notepad, and save.

Next try the undocumented SaveAsText and LoadFromText. Open the Immediate
Window (Ctrl+G), and enter something like this:
SaveAsText acForm, "Form1", "C:\form1.txt"
If that works without an error, delete the form, and compact the database.
Now that the bad form is completely gone, we will try to get Access to
recreate the form from the text file, i.e.:
LoadFromText acForm, "Form1", "C:\form1.txt"

If this works, I suggest you open the form in design view, and set its
HasModule property to No. Answer Yes to confirm the delete. Then compact,
decompile, and compact again. Finally, open the form in design view, and
paste in the code you saved back at step 2.

If the form is badly corrupted, Access may report that it cannot perform the
SaveAsText. You will then need to recreate the form from scratch, but
hopefully you will be able to paste the code in again from Notepad without
having to write it again.
 
P

Pat Hartman

I have two databases that are constantly running into this problem and have
had great success with the SaveAsText and LoadFromText that Allen suggested.
In fact, I just used it yesterday. I have discovered a pattern though.
When you add a control to a form and immediately delete its attached label,
Access seems to object and this has been the last thing I did in several
instances of corrupt forms. So now I save the form and close it before
removing the unneeded label.
 
A

Allen Browne

That's a curious observation, Pat.

I did manage to get a crash by adding a field and deleting the attached
label. But when I created a really simple little database with just one
table and just one form, I was not able to reproduce this. So if it is a
real issue, it must involve interactions with other some factors rather than
merely deleting a label.

Please let us know if you happen to pin down what those other factors might
be.
 
P

Pat Hartman

It is most likely to happen when you edit a subform in situ so I've been
opening the subform itself rather than the mainform and drilling into the
subform. I send all my abends to MS and they got at least 4 yesterday since
I couldn't believe what I was seeing. I sent an example to Zac a few months
ago along with the IDs of the abend records but he couldn't reproduce the
problem even though I could reproduce it reliably. I'm using several dense
(multiple subforms) tabbed forms in the two databases that have been giving
me fits this year and that may be a contributing factor.
 
T

Tirelle

Thanks Allen!!! I did end up having to recreate the form but you saved me
tons of work with the code!! And Pat Thank you for that piece of info also.
I will be more observant of this as well. You guys are great.

Tirelle
 

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