Learn how to a build a cloud-first strategyRegister Now


Error 3020 - Update or Cacel Updade wihout AddNew or Edit

Posted on 2012-08-28
Medium Priority
Last Modified: 2012-08-28
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?
Question by:João serras-pereira
  • 3
  • 3
LVL 61

Accepted Solution

mbizup earned 2000 total points
ID: 38341031
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
          ... etc - code that does the edits
End if

Author Closing Comment

by:João serras-pereira
ID: 38341525
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.

LVL 61

Expert Comment

ID: 38341619
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.
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Author Comment

by:João serras-pereira
ID: 38341776
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...
LVL 61

Expert Comment

ID: 38341858
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.

Author Comment

by:João serras-pereira
ID: 38342084
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.

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
If you’re using QODBC to update QuickBooks data from Microsoft® Access but Access is not showing the updated data, you could have set up QODBC incorrectly.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question