Error 3020 - help needed

  • Thread starter Thread starter AlanD
  • Start date Start date
A

AlanD

I've started getting an error 3020 (Update or CancelUpdate without AddNew or
Edit). I'm using DAO. I'm sure it worked before.

I'm not consciously using .edit, .update etc but perhaps it is implicit in
the general form handling.

The structure is that I have a form which displays/updates data from a
table. The form has a button ('home address') which calls a pop-up form,
again taking data from the same table and applying a filter to get the
required record. I think the problem is caused by attempting to change the
same record via both the main form and the pop-up.

The table holds a 'last changed' timestamp, which is displayed on the main
form. On the pop-up I put in code 'on update' to change
Forms("main form").[timestamp] = now

The error isn't totally repeatable, and I'm struggling to make a tiny
database which misbehaves to order.

My questions (at last!) are

- Am I looking in the right place?

- Are my problems caused with trying to update essentially the same
record via 2 different routes, perhaps with record locking complications?

- What should I be doing?

Thanks for any suggestions
 
Hi AlanD.

Yes: you are looking in the right place, and yes, it is a concurrency issue.

If the form's table has any Memo fields (or hyperlinks, or OLE objects), you
will not be able to edit the same record in different places like that. If
not, you may be able to do so by ensuring the main form is not dirty at the
time you attempt to edit it in the related form, then save the record before
dirtying the main form again.

An alternative might be to use an unbound pop-up form, i.e. it is just a
series of text boxes not bound to any fields. Copy the data into these
fields when the form is launched. Add Ok and Cancel buttons to the popup. In
the Ok button, copy the values back to the previous form. This avoids the
concurrency issues.
 
I recently had what sounds like the same problem. The solution was to do the timestamp in OnDirty event, not BeforeUpdate. In my case it happened when i
tried to use a Find Record combobox on a form that had been modified; the combo was changing the recordset bookmark and then Form.update() was getting
called afterwards -- obviously, if the call went through, it would update the wrong record!

hth
 
Back
Top