Delete record and associations

N

Nike

I am trying to figure out how to delete a record of an
individual on a form and all associations of this person
in any table. Does anyone have a suggestion on how to go
about doing this? I am using CustomerID as a relationship
in about 4 different tables.

Thanks in advance
 
M

Mattias Jonsson

Nike,
If you have the individual's main record up in one form then you can run

CurrentDB.Execute "DELETE FROM [OtherTableName] WHERE CustomerID=" &
Me.CustomerID

once for each one of the other tables. Then you can delecte the record in
the current form with DoCmd. Needs some error handling and maybe a
confirmation question. Also, consider using a "Deleted" flag on records
instead of actually deleting customer records. Another alternative is to
archive the deleted records in another table.

Hope that helps,
Mattias Jonsson
 

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