Question : Access cascading combo boxes

I have used cascading comboboxes several times, but cannot get through this problem.  I am trying to have a form select the appropriate audit by property and year.

I have a tblProperty with PropertyID (PK),  PropertyNameShort, and ProjectStatusID
I have tblPropertiesAudits with PropertyAuditID (PK autonumber), PropertyID and ValidDate

So my property table will have data that looks like:
       PropertyID         PropNameShort        ProjectStatus
             15                     Green Street               9

and my audit table will have data that looks like:
         PropertyAuditID              PropertyID                 Valid Date
                   25                               15                        12/31/2008
                   26                               15                        12/31/2009

In the form header of my form frmPropAuditMaster I have two combo boxes in question: cboPropertySelect and cboAuditYEarSelect

The row source for cboPropertySelect is:

SELECT tblProperty.PropertyID, tblProperty.PropNameShort, tblProperty.ProjectStatusID
FROM tblProperty
WHERE (((tblProperty.ProjectStatusID)=4 Or (tblProperty.ProjectStatusID)=9 Or (tblProperty.ProjectStatusID)=10 Or (tblProperty.ProjectStatusID)=11))
ORDER BY tblProperty.PropNameShort;

With the bound column set to "1" or PropertyID

I have tried all manner of approaches trying to get my cboAuditYearSelect to update after the selection of the property--it should show the available audits for the selected property.

For example, I thought that using the following row source for cboPropertySelect would work combined with a ":Me.cboAuditYearSelect.Requery" in the afterupdate of the cboPropertySelect (the master combo box)

SELECT tblPropertiesAudits.PropertyAuditID, tblPropertiesAudits.PropertyID, tblPropertiesAudits.ValidDate
FROM tblPropertiesAudits
WHERE (((tblPropertiesAudits.PropertyID)=[Forms]![frmPropAuditMaster]![cboPropertySelect]));


I am a beginner, so there is probably something simple I misunderstood.  Thank you.

Answer : Access cascading combo boxes

first you can change the rowSource of cboPropertyselect with this shorter version

SELECT tblProperty.PropertyID, tblProperty.PropNameShort, tblProperty.ProjectStatusID
FROM tblProperty
WHERE tblProperty.ProjectStatusID In(4,9,10,11)
ORDER BY tblProperty.PropNameShort

in the afterUpdate event of cboPropertyselect place this codes

private sub cboPropertyselect_afterupdate()
Me.cboAuditYearSelect.rowsource="SELECT tblPropertiesAudits.PropertyAuditID, tblPropertiesAudits.PropertyID, tblPropertiesAudits.ValidDate FROM tblPropertiesAudits Where PropertyID=" & me.cboPropertySelect

end sub
Random Solutions  
 
programming4us programming4us