Ok, I created a form[frmSubhours] that has 2 cascading combo boxes (cboFaculty and cboProject). Everything works fine, thanks to previous posts about cascading combo boxes. But now I want this form to be a sub form on [frmPayDetails], and it won't work, I get an error message asking to enter the Parameter value for Forms!frmSubhours!cboFaculty that is used in the row source for cboProject. So I think that as it's now on a subform, I must change how I've referred to cboFaculty in this query, but I don't know how. Please help as I've nearly completed the database. Can you also tell me any other changes I may need to make to get the sub form to work eg. do I need to change the other coding that maks the cascading combo boxes work? Thanks in advance.
Here are the details:
cboFaculty is based off a query from the tbFaculty, you select the faculty name, and this filters cboProject to only show projects for that faculty member from tbProject.
cboProject row source:
SELECT tbProject.ProjectID, tbProject.ProjectName, tbProject.CurrentProject FROM tbProject WHERE (((tbProject.CurrentProject)=Yes) And ((tbProject.FacultyID)=Forms!frmSubhours!cboFaculty)) ORDER BY tbProject.ProjectName;
The code source for frmSubhours is
Private Sub cboFaculty_AfterUpdate()
Me.cboProject.Requery
Me!cboProject.SetFocus
End Sub
Private Sub Form_Current()
Me.cboProject.Requery
End Sub
Here are the details:
cboFaculty is based off a query from the tbFaculty, you select the faculty name, and this filters cboProject to only show projects for that faculty member from tbProject.
cboProject row source:
SELECT tbProject.ProjectID, tbProject.ProjectName, tbProject.CurrentProject FROM tbProject WHERE (((tbProject.CurrentProject)=Yes) And ((tbProject.FacultyID)=Forms!frmSubhours!cboFaculty)) ORDER BY tbProject.ProjectName;
The code source for frmSubhours is
Private Sub cboFaculty_AfterUpdate()
Me.cboProject.Requery
Me!cboProject.SetFocus
End Sub
Private Sub Form_Current()
Me.cboProject.Requery
End Sub