On a sub-form I have two cascading combo boxes; cboParent which allows the user to select a year and cboChild which then allows the user to select a course dependent on the year selected in cboParent. I created these using Mile-o-Phile's method in the FAQ here.
However, when I scroll back through the records only the course names that relate to the last selected year show up on the top row of the cboChild box. I need to see the course name that was selected on all the records.
I have tried to use the following code to synchronise them, but it causes a "compile error" when I run the form.
The code came from http://www.fontstuff.com/access/acctut10.htm if that's any help.
Thanks in advance,
Amy
However, when I scroll back through the records only the course names that relate to the last selected year show up on the top row of the cboChild box. I need to see the course name that was selected on all the records.
I have tried to use the following code to synchronise them, but it causes a "compile error" when I run the form.
Code:
Private Sub Form_Current ()
On Error Resume Next
cboParent = DLookup("[YearID]", "SSAllCourses", "[CourseID]='" & cboChild.Value & "'")
cboChild.RowSource = "Select SSAllCourses.CourseID " & _
"FROM SSAllCourses " & _
"WHERE SSAllCourses.YearID = '" & cboParent.Value & "' " & _
"ORDER BY SSAllCourses.CourseID;"
End Sub
End Sub
The code came from http://www.fontstuff.com/access/acctut10.htm if that's any help.
Thanks in advance,
Amy