B
Bob Quintal
Dear Bob,
I have tried both Update and Append queries but both of them don't
work.
Is there any wrong with my query ?
UPDATE ELDERS INNER JOIN Payment ON STAFF.ID = Payment.EmpID SET
Payment.PayYear = "2007", Payment.DatePaid = #1/31/2007#,
Payment.EmpID = [STAFF].[ID]
WHERE (((STAFF.[PAID 2007])=True));
The Update query updates records which already exist. You want an
Append query instead: try
INSERT INTO Payment (EmpID, PayYear, DatePaid)
SELECT STAFF.EmpID, "2007", #1/31/2007# FROM STAFF
WHERE (((STAFF.[PAID 2007])=True));
However, I'd really question storing *both* the PayYear and the
DatePaid! The DatePaid contains the year. Would it be legitimate
to have a PayYear of 2007 and a DatePaid in 2009? Maybe it would,
but it is something to think about!
Actually, the original poster said he wanted to receive a payment today
applicable to this year and next year, I suggested he add the date of
payment in order to be able to determine when payment was made for
future years.
I'd also add the amount paid, or the partial amount covering a year
from the multi-year payment.
And you are absolutely correct in pointing out that it's an append and
not an update query required.
Bob