I need help with a many to many relationship please!

C

cm500

I have been beating my head against a wall over this.

I have 3 tables
1. Employees (employeeID, lastname, firstname, position)
2. Classes(classid, classname, classdescription)
3. Employee classes (classid, employeeid)

Now each employee is assigned to take various classes and each class
can be assigned to more than one employee. A many to many
relationship, right?

So I created the linking table of EmployeeClasses which has employeeID
and ClassID as its fields. Then many one to many relationships from
each of the primary tables.

Now what I want to do is link which classes to which employees.
Preferably through a form /subform with a drop down box letting me
chose the classes by class name from the classes table.

Can't get it to work. Can anyone help me?
Thanks,
...Chris
 
T

tina

did you link the tables in the Relationships window? if so, try selecting
tblEmployees in the database window and then click the AutoForm button on
the toolbar. last time i tried that, Access built the form/subform with the
proper links, for me.
in the subform, EmployeeID will be entered automatically via the link to the
main form. change the text box for ClassID to a combo box and set its'
RowSource to tblClasses.

hth
 
J

John Vinson

Now what I want to do is link which classes to which employees.
Preferably through a form /subform with a drop down box letting me
chose the classes by class name from the classes table.

Can't get it to work. Can anyone help me?
Thanks,

Base a Form on the Student table, and a Subform on the EmployeeClasses
table; use the EmployeeID as the master/child link field.

On the subform there'll be only one control: a Combo Box based on the
Classes table. The combo box wizard will set this up for you - it will
have a RowSource like

SELECT ClassID, ClassName FROM Classes ORDER BY ClassName;

and a column widths property like

0;1

to store the ClassID but display the classname.
 

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