Blank record and error 'Update or Cancel Update without AddNew or Edit'

L

louise

Hi

I have form that opens in FormAdd mode but if the user decides not to
add a record it adds a blank one.

Then if the user chooses to open this record and delete it or even
just close it again, i get the error:

Update or Cancel Update withour AddNew or Edit

How can i either handle this error or prevent a blank record from
being added?

Thanks

Lou
 
A

Allen Browne

Probably a couple of things happening here.

A. Adding the blank record.
Simply opening a form or moving to the new record will not cause it to
create a new record. There must be something - either the user or code -
that is dirtying the record. If you are certain this happens even if the
user does not type anything, then check the events of the form to see if
anything is assigning a value to a control. Particularly, in the form's
Current event.

If you still cannot see where this happens, perhaps you could open the table
that feeds your form in desgn view. Select one of the fields that should
always have a value, and in the lower pane of the table design window, set
this field's Required property to Yes. Save the change, and Access will not
let a blank record be saved.

B. "Update or Cancel ..." error
Does this error message always come from the same code?
Yes: What is the code doing? Does the message make sense there?
No: Then it probably indicates a corruption. Try the following sequence:

1. Uncheck the Name AutoCorrect boxes under:
Tools | Options | General
Explanation of why:
http://members.iinet.net.au/~allenbrowne/bug-03.html

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

3. Close the database, and make a copy of your mdb file, without overwriting
any previous backups.

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

5. Open the database, and compact again.
 

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