By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,384 Members | 714 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,384 IT Pros & Developers. It's quick & easy.

Cascading Combo not showing results

P: 2
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
Share this Question
Share on Google+
1 Reply


NeoPa
Expert Mod 15k+
P: 31,436
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.