Removing unwanted data (email addresses)

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a database which I import emial addresses from several sources then
remove duplicates by using a Select Distinct query (before sending product
bullitens etc by email).

I also have another table in the same database which I hold "unsubcribe"
email addresses in. I need to find a way (using a query I assume) to
automatically delete all records which contain the "unsubcribed" emails from
the main table of data.

Any suggestions would be a great help.
Barry
 
You can do this in 3 steps,
1.Create an update query joining both tables by the email address, and
update the main table's email with the word "Delete"
2.Create a delete query that deletes records in the main table where the
email="Delete"
3.Create a macro that runs those 2 queries after you are run with your import,
 
I also have another table in the same database which I hold "unsubcribe"
email addresses in. I need to find a way (using a query I assume) to
automatically delete all records which contain the "unsubcribed" emails from
the main table of data.

A Delete query will do this. You will need a unique Index on the email
field in the table from which you wish to delete.

Create a Query joining the two tables, joining on the EMail field.
Select (only) the * pseudofield from the main table, and select
nothing from the "unsubscribe" table.

Change the query to a Delete query. The SQL should be something like

DELETE * FROM EMails
INNER JOIN Unsubscribe
ON EMails.EMAIL = Unsubscribe.EMail;

Run the query and zap - you will remove them.

Do make a backup of your database first of course! Deleted is GONE
without any easy recovery.

John W. Vinson[MVP]
 
Back
Top