Re: #Deleted

From: Dirk Goldgar (dg_at_NOdataSPAMgnostics.com)
Date: 09/20/04


Date: Mon, 20 Sep 2004 10:32:04 -0400


"CK" <CK@discussions.microsoft.com> wrote in message
news:0E38BC7C-9340-4C5D-8A35-50D077C8DCDE@microsoft.com
> I have a form that is showing 3 filtered records and I've created a
> button to delete a record. After deleting the record, all the fields
> in the form for that record shows up as #DELETED and the number of
> records still show 3 instead of 2. How do I get the form to "refresh"
> itself? Thanks.
> ck

Presumably your button is deleting the record by running a delete query
or by way of an independent recordset. That's why the form doesn't know
that the record has been deleted.

You can requery the form -- not "refresh", that's actually a somewhat
different operation -- by executing the statement

    Me.Requery

from VBA in the form's module. If you are running the code in some
other module, you have to provide a reference to the form, as in

    Forms!MyForm.Requery

Another alternative, if you want the form to behave the same way it
would if the user clicked the built-in Delete Record button, is to
execute this statement instead of whatever you're doing now to delete
the record:

    RunCommand acCmdDeleteRecord

If the button is not on the form itself, you'd have to first SetFocus to
the form.

-- 
Dirk Goldgar, MS Access MVP
www.datagnostics.com
(please reply to the newsgroup)