View Full Version : cross field querie possible?


Ravinder
05-03-2002, 01:08 AM
I am a teacher with novice experience in Access.
I need to to querie from my database, which subject combination can be handled by a teacher.
In the querie I have two tables "Teacher detail" and "subject level". Eg. Teacher 'A' can teach subject1, subject 2,...subject 6.
User must select from combobox subject 1, subject 2. To list all who can teach that subject. How do I make the querie search for the subject irrelevant of the order. Eg. Teacher 'A' Subject1: maths Subject 2:science . User selects combobox :Science on querie by form , for subject 1.

The display is the teachers that can handle science, thus teacher A shows. Or user selects combobox subject 1:Science subject 2: Maths, teacher 'A' is shown although the order is reverse when entrying the detail.

Presently I can only show it if the order tallys with the data entry order. Thks!

David R
05-03-2002, 08:49 AM
You need three tables really: tableTeachers, tableSubjects, and tableTeacherSubjects.
The first two are your 'main tables'; the Teachers table is equivalent to your "Teacher detail". tableSubjects should be a reference table of all the subjects available...only 6 I believe?

tableTeacherStudents should have two fields only: TeacherID and SubjectID. Make a one-to-many relationship between those sides in the Tools>Relationships window, and you will be able to find out very quickly what teachers can teach what subjects with a query of tableTeacherSubjects and tableTeachers. Use the other side of the relationship if you want to see what subjects a particular teacher can teach.