subforms!

C

Chloe

i have a employee form and a subform with training info info on...the trouble
im having is being able to add more than one traning record for each
employee, i.e. each employee will have up to 30 training record.
i keep getting a message which basically says i cant add more than one
record becuase of the employeeID,
can anyone hlp me please?!!!!!
 
W

Wayne-I-M

Hi Chole

Create a new table to hold the training details. Link this to the employee
table.

tblEmployee
EmployeeID
Emp1stName
EmpSurname
EmpDept
etc
etc

tblTraining
TrainingID
EmployeeID
TrnDate
TrnLocation
TrnQualificationGained
etc
etc

Create the main form from the employee table and the subform from the
tblTraining. Link the 2 forms with the EmployeeIF field

Hope this helps
 
V

Van T. Dinh

Could you post your Table Structure for the Tables being used as the
RecordSources of the Form / Subform combination, especially the details of
PK, FK and unique index.

Without seeing the database, I can only guess that something such as PK or
unique index prevents you from adding multiple Child Records ...
 
C

Chloe

i have an employees table;

employeeID
firstname
lastname
address...
...........

and an training table;
employeeID
course
date
location
cost...
.....

i then have a main form with all the employee's details on it, and on that a
subform(training)
 
C

Chloe

hey! no problem! i've seemed to have fixed it! for now! not sure how, but i
am now able to input many records for each employee!!! thanks very much for
your help!!!!!!!
 
W

Wayne-I-M

Hi

It's sometime a bad idea for things to just start working without the
developer knowing why ?? Oh well - good luck with your project.
 
J

John W. Vinson

hey! no problem! i've seemed to have fixed it! for now! not sure how, but i
am now able to input many records for each employee!!! thanks very much for
your help!!!!!!!

It sounds like you (incorrectly) had the EmployeeID set as the Primary
key of your training table. Since the training table can have many
records, it must use the employeeID as a nonunique foreign key.

John W. Vinson [MVP]
 
C

Chloe

yep, you're absolutely right! after thinking about it i realised that the
employeeID cant be the primary key if i wanna add multiple records for each
employee!! thank you to everyone for their advise!!!
 

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