add multiple records to a table with a form

Karl

New member
Local time
Today, 22:25
Joined
May 19, 2009
Messages
1
Hi All,

Please I need some advice. I've already a database related to absenteeism. Then I'm trying to add new records according to the starting date and end date of the absenteeism. eg:

Table1_employee
fields= num, name

Table2_absenteeismtype
fields= adsenteeism code, description (like 1 maternity, 2 sickness)

table3_absenteeismoccurency
Field= autonum, starting date, end date, employee name and absenteeism code.

form1 to insert data in table3



For example, an employee had to stay at home from 1/02 to 10/02/2009.
Instead of adding a record with startdate 1/02 and end date 10/02, I would like to insert these 2 dates in a form and in this case will be able to create automatically 10 records in the table3 with the same info (employee name and absenteeism code) but for start and end as 1/02, start and end as 02/02, 03/02, ...still 10/02.

I tried to look for a solution as loop or vba but I'm not a expert and it would be fantastic if someone could hlep me in a easy way to complete this task.

Best regards
 
Karl

Please find attached a basic version with no data validation etc. I have used code to add the multiple records.

I have used different names for the tables
tbl_employees is your Table1_employee
tbl_leave_codes is your Table2_absenteeismtype
tbl_leave_records is your table3_absenteeismoccurency

Note, in your table3_absenteeismoccurency you need a field to store the actual date(s) e.g 01/05/2009, 02/05/2009 and not the actual start and finish dates. Also, I have also used emp_id and not the employee name as the employee later on may change their name due marriage, divorce etc.

Have a look at the code behind the form frm_enter_leave and please contact me if you require an explanation etc.
 

Attachments

Users who are viewing this thread

Back
Top Bottom