Append or Update Query????

V

Victoria@DIG

Sorry folks, I should know the answer to this. I have a table that stores
the days employees take off. The table has the following fields:

"Employee Time-Off Table"
Type of Leave (Vacation, sick,jury duty)
Date (date taken)
SAP Number (number unique to each employee)

When I created this table, I forgot to add Company-Paid Holidays (Christmas,
New Year's, etc.) I have another table with the Company-Paid Holdiays:

"Disney Holidays"
Type of Leave (Disney Holiday)
Date (date of holiday)

I need to import the "Disney Holidays" into the "Employee Time-Off Table"
repeating for each SAP number.

Example of desired results:

SAP Type of Leave Date
00001 Disney Holiday 1/1/2007
00001 Disney Holiday 7/4/2007
00001 Disney Holiday 12/25/2007
00002 Disney Holiday 1/1/2007
00002 Disney Holiday 7/4/2007
00002 Disney Holiday 12/25/2007

I know I am thinking too hard and overlooking the obvious. Thanks for your
patience and your help.

Victoria
 
J

John Spencer

The SELECT query would look like

SELECT tblEmployees.SAP, tblHolidays.[Date], tblHolidays.[Type of Leave]
FROM TblEmployees , tblHolidays
WHERE tblHolidays.[Type of Leave] = "Disney Holiday"

The append query would look like

INSERT INTO TimeOffTable (SAP, [Date], [Type of Leave])
SELECT tblEmployees.SAP, tblHolidays.[Date], tblHolidays.[Type of Leave]
FROM TblEmployees , tblHolidays
WHERE tblHolidays.[Type of Leave] = "Disney Holiday"

One problem with that would be you could end up with duplicate records
if you should run it more than once.




'====================================================
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
'====================================================
 

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