Deleting Record with Code

E

Eddy

Using Access2003 I am trying to delete a record on a form. The forms record
source is a query. The line of code I am using is:
If Me.Dirty Then Me.Undo
If Not Me.NewRecord Then
RunCommand acCmdDeleteRecord
End If

It seems to delete the record but when I close the form and go back to it
the record is still there. It is apparently not deleting it from the table
but only the query. I'm new to Access2003. Can anybody help!
Thanks.
 
V

Van T. Dinh

The problem is in the Query, most likely involving 2 or more Tables.

Try deleting a row in the DatasheetView of the Query. You probably find
that after deleting, the Record is still in the Table.

I cannot remember the rule about deleting (since I don't use multi-Table
Queries for deletion) but IIRC, you can only delete the Child Records if the
2 Tables are joined / related by One-to-Many relationship.
 

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