Error# 3167: Record is deleted (???)

  • Thread starter (PeteCresswell)
  • Start date
P

(PeteCresswell)

Anybody know the genesis of this error besides the obvious?

i.e. I'm working in a form/subform that's using work tables and a record is
definitely there. It's definitely not the same record as a few moments ago...
but then again, it *never* is... It's a record in a work table that serves as
..RecordSource for a subform and it's always blown away and replaced each time a
new parent record is loaded.

In that subform there's an unbound combo box.

If the user chooses something from the box various routines run and all is well.

OTOH if the user nulls out the combo box and the same routines run, all is well
for that particular record... and the "Save" coding runs OK, but when we try to
load another record - with it's own values for that particular subform, Access
throws the 3167.


My suspicion is that I'm somehow updating some form-level flag that Access
maintains and that's tripping me up.

Can somebody comment in the context of forms and flags?
 
P

(PeteCresswell)

Per (PeteCresswell):
My suspicion is that I'm somehow updating some form-level flag that Access
maintains and that's tripping me up.

To (maybe..) clarify:

We have a form with a subform. The subform is based on a single-record work
table. When the a new parent entity is loaded, that work table's record gets
deleted and the new parent's child gets copied into it.

On the subform, there is an unbound combo box with LimitToList=True

AfterUpdate code behind the unbound combo box updates another (bound) combo box.

If the user just selects something in the unbound box and continues, everything
is ok.

But if the user Nulls out the unbound box and saves the record.

The next time we load another parent entity (and the subform's .RecordSource has
been deleted and replaced with a new record) when the code does a
..SubWhatever.Form.Requery, it fails with "Record is Deleted".

Seems likely that somehow the process invoked by the unbound combo box's
AfterUpdate is somehow leaving the subform thinking that a certain record should
be behind it - and it's throwing that error when it's requeried and that record
isn't there. And somehow, when the combo box is Nulled the resulting process
leaves the subform thinking that... but not when the combo box is set to one of
it's list items.

But what's the mechanism for the subform's knowing this? I've got
..SubWhatever.Form.Refresh in the code that saves the subform's contents....
 
P

(PeteCresswell)

Per (PeteCresswell):
Can somebody comment in the context of forms and flags?

Got it. Went back to Albert's advice on .Refresh.

Was doing it in the first place, but not in the right place/at the right time.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top