Hi John, thanks for replying.
Well, my form is a "Continuous form", and its data source is tblStudents.
In this same form, I would like to have a listbox containing a list of the
student's Lecture Codes (tblLectures)
The student currently selected on the Subform? That will need some
code.
tblStudents and tblLectures are related through a third table called
tblSTULEC, which contains only idStudent and idLecture.
The rowsource for the listbox is: Select * from tblSTULEC where
idStudent=Me!idStudent
Well, Me! is meaningful only in VBA code. It won't work in a Query.
And this will retrieve the idLecture value, not the name of the
lecture (unless the idLecture field IS the human-readable name). See
below.
This is supposed to be a form just to see a list of all students in the
database. The detailed information is entered on a separate form (which is a
Single form).
All works well in the single form (relationships, etc), but I couldnt get
the all data in the related tables to be displayed in the Continuous form.
Do you want ALL classes for ALL students listed simultaneously?
That'll a) be difficult to do and b) all but impossible to read...
I couldnt get it to work, so I've tried adding a subform, but I cant have a
subform in a Continuous form, and the Datasheet view is just not nice
looking enough....
Well, I hope I managed to explain myself better now., if not maybe I can
send screenshots?
Well, let's see if we can't get this done on the newsgroup instead - I
try to reserve EMail support to paying clients (I'm a self-employed
consultant donating time here), and it's not good form to upload
binaries.
Try basing the Listbox on a query like
Select tblSTULEC.idStudent, tblLectures.LectureName
FROM tblSTULEC INNER JOIN tblLectures
ON tblSTULEC.idLecture = tblLectures.idLECTURE
where tblSTULECT.idStudent =
Forms!YourMainForm!subformname.Form!idStudent
ORDER BY LectureName;
using your own table and fieldnames; "subformname" should be the Name
property of the subform control (which isn't necessarily the same as
the name of the form within that control).
You'll also need one line of VBA code: in the Current event of the
subform put
Private Sub Form_Current()
Parent!lstSTULEC.Requery
End Sub
where lstSTULEC is the name of the listbox.
This will let you scroll down the list of students; the listbox will
change with each move to reflect that student's enrollment.
John W. Vinson[MVP]