Newbie Access developer here, and my first post on this forum, so I might not get everything right - thanks in advance for your help and your patience!
I'm using Access 2007, in XP. I'm currently trying to set up a whole pile of cascading combo boxes of different levels of complexity, so I started with the easiest set - and can't even get that to work (even using the tutorial on this site at http://bytes.com/insights/access/605...mbo-list-boxes) , so I'm turning to you guys for assistance. My table structure and code for this is as follows.
Tables: "Specialties" and "Departments"
where "Specialties" includes a field (DepartmentsID) which is a lookup to the "Departments" table.
Aim: two combo boxes in a form, where the Department selection filters the possible selections for Specialty.
In the form, the RecordSource is the Specialties table, but the bound Department combo box has its ControlSource as DepartmentID and its RowSource as
Expand|Select|Wrap|Line Numbers
- SELECT Departments.ID, Departments.DepartmentName
- FROM Departments;
Expand|Select|Wrap|Line Numbers
- Private Sub DepartmentID_AfterUpdate()
- On Error Resume Next
- Specialty.RowSource = "Select Specialties.SpecialtyName " & _
- "FROM Specialties " & _
- "WHERE Specialties.DepartmentID = '" & DepartmentID.Value & "' " & _
- "ORDER BY SpecialtyName;"
- End Sub
What am I missing?
Thanks again for your help
Toi