Append to Access table
Posted on 2011-03-05
I have a small database consiting of two tables,tblEmployees and tblDates.
tblEmployees consists of the following fields;
pkEmpId Primary Key (autonumber)
tblDates fields are;
pkDatesID Primary Key (autonumber)
DOE date (current date)
It is a simple database to view and update Employee holidays.
Every year (April 1st), each employee is given 9 days holidays for the next 12 months. This is in addition to the company days and public days.
tblDates has records for holidays taken and accrued, some employees may have many records and others may have only a few records, whereas new employees may not have any records at all yet.
I have a button on a form, which if certain criteria is met, should run an append query.
I need to append new records into tblDates for each employee in tblEmployees where EndDate is null (still employed).
The fields in tblDates need to be filled-in with the following data;
HolsTaken = 0, DaysInLieu = 0, DateFrom = April 1st (currentYear), DateTo = March 31st (NextYear), HolsAdded = 9, DOE = (current date)
I hope this isn't too much to ask.
Thanks in advance