Check for date in table

T

Tod

I have an append query that appends data from one table to
another. I use the query monthly. Each set of data is for
a given month. I'm trying to come up with a way to insure
that I do not copy the data more than once. None of the
fields have unique values. (I don't have control over the
table structure.) However, each month of data has only
dates for that month. So I could check the table I'm
appending to for dates containing that month.

How can I use a query, macro or other to check that the
table does not have dates for the month of data I'm
appending and then prompt me or cancel the appending?

tod
 
G

Gerald Stanley

Try refining you Append query with a WHERE clause that
checks that the date in the column on the monthly table is
greater than the Max date on the appended table e.g.

INSERT INTO etc
SELECT etc FROM etc
WHERE YourMonthlyTable.dateColumn > Select(Max(dateColumn)
FROM YourAppendedTable)

Hope This Helps
Gerald Stanley MCSD
 
J

John Vinson

So I could check the table I'm
appending to for dates containing that month.

If you will never have two valid records with the same date, simply
set a unique Index on the date.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top