470,632 Members | 2,098 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,632 developers. It's quick & easy.

Cascading Combo not showing results

I am new to Access and have been charged with creating a database for our course alumni.

I currently have a "Contacts" form and am trying to create a subform to hold the course alumni information. I would like the first combo box to contain the course and the second to show the approriate years. Everything seems to be working except the years are not showing in the second combo box.

My tables are set up as:

CourseNames
CourseID (primary key)
CourseName (text)

Years
YearID (primary key)
Years (text)

CourseYears
CourseYearID (primary key)
CourseID (numbers)
YearID (numbers)

In the CourseYears table I have entered in the CourseID and YearID for the appropriate combinations. I am trying to create cascading combo boxes so that when the course is chosen, the appropriate years will appear.

I have two combo boxes: CourseName and CourseYear

The code for my CourseName after update is:
Expand|Select|Wrap|Line Numbers
  1. Private Sub CourseName_AfterUpdate()
  2. Dim strSQL As String
  3.  
  4. strSQL = "SELECT CourseNames.CourseID, Years.YearID, Years.Years FROM CourseYears INNER JOIN " & _
  5.          "(CourseNames INNER JOIN CourseYears ON CourseNames.CourseID = CourseYears.CourseID) " & _
  6.          "ON Years.YearID = CourseYears.YearID WHERE CourseNames.CourseID= " & Me![CourseName].Column(0)
  7. Me![CourseYear].RowSource = strSQL
  8. Me![CourseYear].SetFocus
  9. Me![CourseYear].Dropdown
  10. End Sub
This is not showing the years in the second combo box.

Any help you could give me is much appreciated!
Jun 24 '09 #1
1 1530
NeoPa
32,301 Expert Mod 16PB
Hi. Check out Example Filtering on a Form and let us know if you manage to resolve it from this.

Welcome to Bytes!
Jun 24 '09 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

6 posts views Thread by visionstate | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.