Record in table "TABLE NAME" was deleted by another user

  • Thread starter Thread starter Sheldon
  • Start date Start date
S

Sheldon

I am using the navigation buttons to traverse a table.
Only one record currently exists in the table(key xxx1). I
go to record 2 and blank form comes up with a calculated
key (xxx2). The table is BOUND to the form. I go back to
record 1. Record 2 is automatically written to the
database. I then a Delete SQL to remove the decond
record. The first record now appears on the form (xxx1).
I go back to record 2. Instead of a blank record 2 being
displayed, I get the error message "Record in
table 'TABLE_NAME' was deleted by another user". I need
to recreate automatically rec 2 just like it was the first
time. HOW??


Thanks
 
Sheldon said:
I am using the navigation buttons to traverse a table.
Only one record currently exists in the table(key xxx1). I
go to record 2 and blank form comes up with a calculated
key (xxx2). The table is BOUND to the form. I go back to
record 1. Record 2 is automatically written to the
database. I then a Delete SQL to remove the decond
record. The first record now appears on the form (xxx1).
I go back to record 2. Instead of a blank record 2 being
displayed, I get the error message "Record in
table 'TABLE_NAME' was deleted by another user". I need
to recreate automatically rec 2 just like it was the first
time. HOW??

What you're seeing sounds like perfectly correct behavior to me. After
you've added the second record (presumably by having code behind the
form set the value of the key field, and then moving back to the first
record, thus forcing a save), you run a delete query *external to the
form* that deletes the record that is still in the form's recordset.
The record has been deleted by "another user" -- your delete query --
but there's still a slot for it in the form's recordset, so when you go
to view it you get the message you see.

How to work around this and avoid the message? After you run the query
that deletes the record, requery the form. If the form is named
"MyForm", execute the VBA statement

Forms!MyForm.Requery

If the statement will be executed within the form's own code module, you
can shorten that to

Me.Requery
 
Back
Top