Return to Snippet

Revision: 65818
at January 23, 2014 05:34 by gtree

Initial Code
DoCmd.RunSQL "DELETE * FROM tblAttachments WHERE tblAttachments.ID IN (SELECT tblAttachments.ID FROM tblAttachments INNER JOIN tblEmails ON tblAttachments.ID = tblEmails.ID WHERE (((tblEmails.[Date Completed])<DateAdd('m',-6,Date()))))"

Initial URL

Initial Description
Completed in Access where this example deletes whole record from tblAttachments based on the ID pulled from another query--Select statement in ( )-- that query pulls IDs which have a matching ID in both tblAttachments and tblEmails, and Date Completed in tblEmails is older than 6 months ago to date

Initial Title
Delete records from table based on a query

Initial Tags

Initial Language
Visual Basic