A family of Microsoft relational database management systems designed for ease of use.
The nearest example I can give you is one where the unbound controls to restrict the results returned are in the header of a bound form, rather than in a separate dialogue form. The only difference is that the current form is requeried rather than a separate form. The file is ComboDemo.zip in my public databases folder at:
https://onedrive.live.com/?cid=44CC60D7FEA42912&id=44CC60D7FEA42912!169
Note that if you are using an earlier version of Access you might find that the colour of some form objects such as buttons shows incorrectly and you will need to amend the form design accordingly.
If you have difficulty opening the link copy its text (NB, not the link location) and paste it into your browser's address bar.
In this little demo file take a look at the option to 'Open simplified form for 'drilling down' through hierarchies to return records.' The unbound controls in this form are correlated combo boxes in which a selection in one limits the available selections in the next down the line, but that's not relevant. They'd work on exactly the same way if they were independent of each other. The form's RecordSource is the following query, which is set up as Dirk described ealier:
SELECT Counties.County, Districts.District, Parishes.Parish, Locations.Location,
Parishes.ParishID
FROM ((Counties INNER JOIN Districts
ON Counties.CountyID = Districts.CountyID) INNER JOIN Parishes
ON Districts.DistrictID = Parishes.DistrictID) INNER JOIN Locations
ON Parishes.ParishID = Locations.ParishID
WHERE (Counties.CountyID=[Forms]![frmDrillDown_Simple]![cboGotoCounty]
OR [Forms]![frmDrillDown_Simple]![cboGotoCounty] IS NULL)
AND (Districts.DistrictID=[Forms]![frmDrillDown_Simple]![cboGotoDistrict]
OR [Forms]![frmDrillDown_Simple]![cboGotoDistrict] IS NULL)
AND (Parishes.ParishID=[Forms]![frmDrillDown_Simple]![cboGotoParish]
OR [Forms]![frmDrillDown_Simple]![cboGotoParish] IS NULL)
ORDER BY County,District,Parish;
The form is requeried in the AfterUpdate event of each combo box:
Private Sub cboGotoCounty_AfterUpdate()
' set district and parish combo boxes to Null
' and requery controls to show districts in
' selected county
Me.cboGotoDistrict = Null
Me.cboGotoDistrict.Requery
Me.cboGotoParish = Null
Me.cboGotoParish.Requery
' requery form to show locations
' in selected county
Me.Requery
End Sub
Private Sub cboGotoDistrict_AfterUpdate()
' set parish combo boxes to Null
' and requery control to show parishes in
' selected district
Me.cboGotoParish = Null
Me.cboGotoParish.Requery
' requery form to show locations
' in selected district
Me.Requery
End Sub
Private Sub cboGotoParish_AfterUpdate()
' requery form to show locations
' in selected parish
Me.Requery
End Sub
The only line in each your need to concern yourself with is:
Me.Requery
The other lines correlate the controls.