Delete record and associations

  • Thread starter Thread starter Nike
  • Start date Start date
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
 
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
 
Back
Top