View Full Version : Adding Multiple Records into Table Automatically


veraloopy
08-06-2009, 01:29 PM
Hi

I'm a little stuck with adding data into a table automatically based on a set list of skills

I have 3 tables: tblEmployees, tblEmployeeSkills and tblSkillNames

tblEmployees contains employee names
tblSkillNames contains names all the relevant skills
tblEmployeeSkills contains all the skills that an employee has along with a skill level of 'Trained' or 'Requires Training'

When a new starter joins the company, that person will have around 40 skills added to his/her name and the skill level will be set to 'Requires Training.

Is there a way I can create a 'set' of skills and by choosing an employee name and the skill set name, it will add each skill for that employee in tblEmployeeSkills with a Skill Level of 'Requires Training' automatically to save me typing out all 40 skills individually??

I know this one seems a little long winded so I thank you in advance for any help :-)

boblarson
08-06-2009, 01:41 PM
Hi

I'm a little stuck with adding data into a table automatically based on a set list of skills

I have 3 tables: tblEmployees, tblEmployeeSkills and tblSkillNames

tblEmployees contains employee names
tblSkillNames contains names all the relevant skills
tblEmployeeSkills contains all the skills that an employee has along with a skill level of 'Trained' or 'Requires Training'

When a new starter joins the company, that person will have around 40 skills added to his/her name and the skill level will be set to 'Requires Training.

Is there a way I can create a 'set' of skills and by choosing an employee name and the skill set name, it will add each skill for that employee in tblEmployeeSkills with a Skill Level of 'Requires Training' automatically to save me typing out all 40 skills individually??

I know this one seems a little long winded so I thank you in advance for any help :-)

Yes, use an append query to add them to the table. If you need help, post what you have and I'll try to do something up. I just did that for someone else recently but I am not sure where the post is.

veraloopy
08-06-2009, 02:08 PM
Thanks for the quick reply.

I've never worked with an append query before but have had a good go.

Here is the code... it seems to work but then shows 'You are about to update 0 rows...'


INSERT INTO tblEmployeeSkills ( EmployeeName, SkillLevel, SkillName, SkillSubName )
SELECT tblEmployeeSkills.EmployeeName, tblEmployeeSkills.SkillLevel, tblSkillSet.Skill, tblSkillSet.SkillSubName
FROM tblSkillSet, tblEmployees INNER JOIN tblEmployeeSkills ON tblEmployees.ID = tblEmployeeSkills.EmployeeName
WHERE (((tblEmployeeSkills.EmployeeName) Like [Enter Employee Name]) AND ((tblSkillSet.SkillSetID) Like [Enter Skill Set Number]));



Many thanks :):)

veraloopy
08-06-2009, 02:09 PM
Sorry forgot to add in my last post that I have added an extra table called tblSkillSet which has a list of all the skills along with an id number to identify different sets of skills

Thanks

boblarson
08-06-2009, 02:21 PM
When I said "post what you have" I was hoping for the database file :)