I am using MS Access 2010 to store records about audits that take place at our hospital. I am trying to create a form where it will filter the audits according to the drop down options selected.
I want the Specialty combo boxes to cascade from Directorate, so if I select "Family and Public Health" Directorate, only the Specialties that are within that Directorate appear in the combo box below.
My ComboDirectorate Row Source is SELECT [tblDirectorate].[Directorate Key], [tblDirectorate].[Directorate] FROM tblDirectorate;
My ComboSpecialty Row Source is SELECT tblSpecialty.[Specialty Key], tblSpecialty.Specialty FROM tblSpecialty;
I then have After Update code for ComboDirectorate:
Private Sub ComboDirectorate_AfterUpdate()
Me.ComboSpecialty.RowSource = _
& "SELECT [tblSpecialty].[Specialty Key], [tblSpecialty].[Specialty]" _
& "FROM tblSpecialty WHERE [tblSpecialty].[Directorate] = " _
& Me.ComboDirectorate
Me.ComboSpecialty.Requery
End Sub
This doesn't seem to have any affect on the specialties listed.
I have tried putting in ' ' as per Can't get the cascading combo boxes to work
WHERE Directorate = '" & Nz(Me.ComboDirectorate) & "' " & _
But it still doesn't list the specialties according to the directorate selected.