Remove #Deleted Fields

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

In my form is a delete button which has code to delete the record from a
table but the fields in the form still show the #Deleted in the fields. I
have added the Me.Requery but it still shows all the #deleted fields. Is it
the underlying query which the form is based that has a problem?

Dim MemSQL As String
MemSQL = "DELETE FROM tblMembers WHERE lngMemberID = " & _Me.lngMemberID & ";"
CurrentDb.Execute MemSQL
Me.Requery

Thanks.
ck
 
Hi,

I have found a timing issue with the way you are doing this, it is not to
say its wrong, quite the opposite, you are using a very fast method to
delete the record and by the time the me.Requery is happening the form does
not know about the delete, stick a me.refresh in there just to slow it down
a bit. If you come off the form and back on the record is deleted ?, if so
it is the form not keeping up with the db, also try DoEvents great for
slowing things down.
 
Thanks, Alex for the tip. I've tried putting several Me.Refresh in between
hoping to stall it a little but it's the same. If I use the navigation button
to move to the previous record and then back to the one I just deleted, it
still shows up as #Deleted. Could it be because I am deleting a record from a
table which is part of a query in which the form is based on? Is there a way
to requery a query?
ck
 
me.requery, but you have already tried that, me.refresh, if you close the
form after the deletion and open it again it has gone, no deleted record?
 
Is it a subform?



CK said:
Thanks, Alex for the tip. I've tried putting several Me.Refresh in between
hoping to stall it a little but it's the same. If I use the navigation button
to move to the previous record and then back to the one I just deleted, it
still shows up as #Deleted. Could it be because I am deleting a record from a
table which is part of a query in which the form is based on? Is there a way
to requery a query?
ck
 
If I close the form and open it again, it is gone. I think there is something
not really right with the query on which the form is based. I'll try out with
the form just based on the table and see what happens. Thanks.
ck
 
because the #deleted# record disappears when the form is closed and then
re-opened, this is a refreshing issue, try the following rather than execute
method.

DoCmd.RunCommand acCmdDelete
Me.Requery
Me.Refresh
DoCmd.GoToRecord , , acLast

hope it works, post back if you are still having problems
 
Thanks Alex. I tried with your suggestion but then, nothing happens. It
doesn't delete the record and no error message appears either. I think it is
the query behing the form that is causing this problem so I have removed the
query and replaced the source based on a single table instead. The additional
info belonging to another table have been exposed as a subform. This has kind
of solved the problem. Thanks again for your help.
ck
 
Back
Top