Error Message

S

Stan

When I try to change some code in a module, I get a Runtime Error saying
abnormal program termination and the database automatically closes. Any idea
what might be causing this?
 
A

Allen Browne

Try the standard recovery sequence listed here:
http://allenbrowne.com/recover.html

If that doesn't solve it, post back with more details. Is this the code for
ONE form or report? Or is this any time you open any module in this
database? Or in any database (even a brand new one?) And are you able to get
the code window open? (i.e. does it only crash when you try to change it?)
 
S

Stan

Well regretfully this didn't work. The code is tied to a form but seems to
be on all the code or anytime I open a module. I am able to get the code
window open. Yes, it only crashes when I try to change it.
 
A

Allen Browne

Okay: it's good that you can view the code.

I'm surprised that the decompile didn't fix it.
Try creating a new (blank) database.
Add some simple code, e.g.:
Function DoThis()
Debug.Print "Worked okay"
End Sub
Save.
Compile.
Close the database.
Open.
Can you edit this again?

NO: There's something wrong with Access, or another add-in. Remove any
add-ins you have. Remove Office. Install from scratch.

YES: Then there's something wrong with this particular database. Decompile,
and then compact again (Steps 4 & 5 of the sequence you did before.)
Then creat a new (blank) database.
Turn off Name AutoCorrect.
Set minimal references.
Import all the *other* objects from your old database (i.e. the ones that
don't have this problem.)

If everything is working as expected without this one form, these steps
might rescue the problem one:
1. Open the old database again. Open this form in design view.
2. Open the code window, and copy the code to clipboard.
3. Paste it into Notepad, and save it as a text file.
4. Close the code window.
5. In the main Access window, set the form's HasModule property to No.
Answer Yes to the confirmation dialog.
6. Compact the database.
7. Open the Debug window (Ctrl+G), and enter something like this:
SaveAsText acForm, "Form1", "C:\MyFolder\Form1.txt"
using your form name instead of Form1, and a suitable folder.
8. Close that database.
9. Open the new database you are building.
10. Open the Debug Window (Ctrl+G), and enter:
LoadFromText acForm, "Form1", "C:\MyFolder\Form1.txt"

If that worked, you now have the bad form in your new database. You can now
open its module, and paste in the code you saved at Step 3 above.
 

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