Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

populating a sub form

Status
Not open for further replies.

logopolis

Technical User
Oct 10, 2002
59
0
0
ES
Is it possible to populate a subform when certain information is put into a form.
E.G. If you wished to record results for different students who are in different classes. Each student would be recorded in a table with his/her class in the same table. When you come to the form to record results the main body of the form would have the details of the work done and a combo box for the classes. Once the class is selected a list of students would appear in the sub form for that class, in effect entering them into a third table of results. I do not want this to be done with a drop down in the subform as I want to see all the students who should have results, and also it would save time when entering results.
 
I am a little confused on your different tables, but a few more details will help. Lets say it is structured like below. I assume that students are only in one class and that all classes do all projects, if not you will need a many to many join table:


tblStudents
studentID
studentName
foreignKeyClassID

tblClasses
ClassID
TeacherName

tblProject
projectID
projectName

tblResults
foeignKeyProjectID
foreignKeyStudentID
textGrade
foreignKeyClassID

In the subform tblResults would be in a query with tblClasses and tblStudents so that you are showin

qryResults
StudentName
textGrade

Now the trick is you are going to have run a series of append queries to make a record for each student for every project in the results table. This will stick a projectID, studentID, and classID from tblStudents and tblProjects into the table tblResults. Now link your subform by projectID, but additionally filter the subform by classID.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top