Audit Trail Error

G

Guest

I am trying to implement Allen Brown's audit trail. I keep getting an error
message though when changing (editing, deleting, etc.) a form. The message
says, "You can't save this record at this time. Microsoft Office Access may
have encountered an error while trying to save a record. If you close this
object now, the data changes you made will be lost. Do you want to close the
database object anyway?"

I don't even know where to start looking for the source of my problem. Any
suggestions would be great! Thanks!
 
A

Allen Browne

That message indicates that the form you are using is dirty (unsaved edits)
at the time you are trying to close it.

Is there anything in the Current or AfterUpdate events of the form that is
altering the value of a control on your form?
 
G

Guest

I did have two fields on the form that were updated with the user ID and
current time after a change was made (used ControlName_AfterUpdate). I have
removed those for now to see if the audit trail will work, but now when I try
editing a value on the form it locks up and I am forced to close out of my
main form. On closing, I again get the "Unable to save" error message. I am
at a loss.

Thanks for your help.
 
A

Allen Browne

The AfterUpdate of the *control* is not a problem.

There may be some bad code somewhere, or possibly a corruption.

If you can't find the problem with the code, and think a corruption is
likely, follow these steps:

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

2. Compact the database to get rid of this junk:
Tools | Database Utilities | Compact

3. Close Access. Make a backup copy of the file. 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"

4. Open Access, and compact again.

5. 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

6. Still in the code window, choose Compile from the Debug menu.
Fix any errors, and repeat until it compiles okay.

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
 
G

Guest

Wow, thanks Allen. I'll follow your steps and hopefully everything will be
fixed! Thanks again!
 
G

Guest

It works! I had to follow the steps for the first symptom in your article
"Recovering from Corruption" and the audit trail works great now. Thank you
so much!
 

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