/ Published in: Visual Basic

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
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
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()))))"
Comments
