Thanks for looking.
I'm currently working with a very large database which contains a lot of duplicates. I had a lot of help in my last thread but I have a few more questions I need to find answers for.
I'm currently working with a very large database which contains a lot of duplicates. I had a lot of help in my last thread but I have a few more questions I need to find answers for.
The project I am working on is based on email analysis. I have restored five mailboxes and imported them into a database for filtering /analysis. Duplicate emails exist across and within these mailboxes and I am trying to remove these duplicates unless they are in a designated 'protected email folder'. To make things more complicated I also need to give priority to the emails that I am deleting; for example if duplicates are identified, delete first from mailbox C, then from mailbox B then from mailbox A- mailbox A has top priortiy- email from mailbox C gets deleted before mailbox B which gets deleted before mailbox A.
I am basing the dedup process on four queries and two look up tables.
Lookup Tables
Lookup Table 1: tblFilePriority
Contains two fields [File] and [FilePriority]. The File field contains the name of the mailbox and the FilePriority field contains a number (1-5) to give each mailbox a priority value.
Lookup Table 2: tblProtectedFolders
Contains two fields [Folder] and [Protected]. Folder contains a list of all mailbox folders and Protected lists a 1 next to a folder which must not be deleted (even if duplicates exist) and a 0 next to folders which may be deleted if a duplicate is found.
Queries
Query 1: qryFindImportantEmails
SELECT Min(tblFilePriority.FilePriority) AS MinOfPriority, tblEmails.From, tblEmails.Subject, tblEmails.Sent
FROM tblEmails INNER JOIN tblFilePriority ON tblEmails.File = tblEmails.File
GROUP BY tblEmails.From, tblEmails.Subject, tblEmails.Sent;
Query 2: qryFindProtectedFolders
I need help on this....
Query 3: qryFindDuplicateEmails
SELECT tblEmails.*
FROM tblEmails INNER JOIN qryImportantEmails ON (tblEmails.from = qryImportantEmails.from) AND (tblEmails.Subject = qryImportantEmails.Subject) AND (tblEmails.sent = qryImportantEmails.sent)
WHERE (((qryImportantEmails.MinOfFile)<>[tblEmails].[File]));
This does not run at the moment. I get an 'enter parameter value' box.
Query 4: qryDeleteDuplicateEmails
DELETE *
FROM tblEmails
WHERE tblEmails.ID
IN
(SELECT ID FROM qryDuplicateEmails);
As you may have guessed, I'm pretty new to Access so I won't be offended if you feel the need to explain things at a basic level.
Thanks again for reading.
Pete
I am basing the dedup process on four queries and two look up tables.
Lookup Tables
Lookup Table 1: tblFilePriority
Contains two fields [File] and [FilePriority]. The File field contains the name of the mailbox and the FilePriority field contains a number (1-5) to give each mailbox a priority value.
Lookup Table 2: tblProtectedFolders
Contains two fields [Folder] and [Protected]. Folder contains a list of all mailbox folders and Protected lists a 1 next to a folder which must not be deleted (even if duplicates exist) and a 0 next to folders which may be deleted if a duplicate is found.
Queries
Query 1: qryFindImportantEmails
SELECT Min(tblFilePriority.FilePriority) AS MinOfPriority, tblEmails.From, tblEmails.Subject, tblEmails.Sent
FROM tblEmails INNER JOIN tblFilePriority ON tblEmails.File = tblEmails.File
GROUP BY tblEmails.From, tblEmails.Subject, tblEmails.Sent;
Query 2: qryFindProtectedFolders
I need help on this....
Query 3: qryFindDuplicateEmails
SELECT tblEmails.*
FROM tblEmails INNER JOIN qryImportantEmails ON (tblEmails.from = qryImportantEmails.from) AND (tblEmails.Subject = qryImportantEmails.Subject) AND (tblEmails.sent = qryImportantEmails.sent)
WHERE (((qryImportantEmails.MinOfFile)<>[tblEmails].[File]));
This does not run at the moment. I get an 'enter parameter value' box.
Query 4: qryDeleteDuplicateEmails
DELETE *
FROM tblEmails
WHERE tblEmails.ID
IN
(SELECT ID FROM qryDuplicateEmails);
As you may have guessed, I'm pretty new to Access so I won't be offended if you feel the need to explain things at a basic level.
Thanks again for reading.
Pete