• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 743
  • Last Modified:

Error 3020 - Update or Cacel Updade wihout AddNew or Edit

I am consistentlly getting the above error on  routin that was not changed before.
Below I am sending in a screenshot of the code.
Could be that the T01 table is modified elsewhere?
screenshot
0
João serras-pereira
Asked:
João serras-pereira
  • 3
  • 3
1 Solution
 
mbizupCommented:
Try placing the Edit line in the same IF-Then block as the statements where that recordset is bieng edited and updated -- right after the following line:

IF Found Then
       YourRecordset.Edit
          ... etc - code that does the edits
        YourRecordset.Update
End if
0
 
João serras-pereiraAuthor Commented:
It worked.

I still can't understand why it worked before and, suddenly stopped working... anyway, in the future I'll do this new way.

Thanks!
0
 
mbizupCommented:
I believe your method would work with an AddNew statement.

The difference with .Edit is that you need to be pointing to a specific record for the Edit to take place.  Operations that involve moving to different records may 'cancel' an edit.

I'm not sure that the exact placement of your .Edit is critical (it is my own preference to have it grouped snugly with the actual edits and updates just for code organization), but it should be placed AFTER whatever code you have to take you to the record that needs to be edited.

As a side note, when posting code - if you post copy/pasted code as text instead of screenshots, it makes it easier for us to copy your code into our comments for better/more precise responses.
0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

 
João serras-pereiraAuthor Commented:
Many thanks for the help.

Also for the code hint: I will start pasting the code instead of screenshotting it. It did it only to eveidence the problem with the messages issued by the VBA subsystem and make easier to show the problem. Maybe I should do both...
0
 
mbizupCommented:
That would work well -- or even if you use code snippets, mention the problematic line number(s).  Whatever is easiest :-)

Btw, I got the email notifs on your other question, but can't download .accdb format files at the moment.  If no one else jumps in, I'll take a look at it later today from a computer that I have Access 2010 installed on.
0
 
João serras-pereiraAuthor Commented:
Thanks for the help. The other question is still pending.
The suggestion did not work and I am still scratching my head on how to correctly put a form control source correct so it shows the result of a query (recordset).

It on Form F0304. The problem is that, even the current approach (using a single complicated SQL) is not so good.

In reality there will be too many fields plus and /or options and even double metaphone, so I should, in reality, be able to construct an RST by parts and the either expand it with new records (I would use the .AddNew) ir set up more filters (a query on a query on query.... - ideally a query that has a source that its itself, do you follow?

Anyway, I updated the database and uploaded it again and, this time, inseted the relevant code as actual text.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now