How can I change list box's content via other list box's selected item?

  • Thread starter Thread starter Ruzanna
  • Start date Start date
R

Ruzanna

Hello,

In the subject all my question, but if it's not enough, I'll try t
explain it with more detiles.

For example I have application for University Entrants.
I have a list box with all examinations. And I need for definit
student fill application with selections from that list box, and I wan
that for definite student there will be other list box with al
selections examens from main examination list box.

How can I do it?

I'm very thankfull for any answer.
Ruzann
 
In the AfterUpdate event of the first listbox, you set the SQL for the
second listbox.

If the first listbox is named lstStudents, and the second listbox is namde
lstExaminations, you'd probably have something like:

Private Sub lstStudents_AfterUpdate()
Dim strSQL As String
strSQL = "SELECT Examination "
strSQL = strSQL & " FROM Examinations "
strSQL = strSQL & "WHERE StudentID = " & Me!lstStudents
Me!lstExaminations.RowSourceType = "Table/Query"
Me!lstExaminations.RowSource = strSQL
End Sub

This assumes that lstStudents is set to Multiselect None (i.e.: you can only
pick a single student from the list), that StudentID is a numeric field and
that it's the Bound column of lstStudents.
 
Back
Top