Link to home
Start Free TrialLog in
Avatar of João serras-pereira
João serras-pereiraFlag for Portugal

asked on

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?
User generated image
ASKER CERTIFIED SOLUTION
Avatar of mbizup
mbizup
Flag of Kazakhstan image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of João serras-pereira

ASKER

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