I have two combo boxes on a form. I was trying to follow http://www.fontstuff.com/access/acctut10.htm Example 2 for single source table.
My source table is qryAdminCoFarms with columns [Admin County] and [Farm Number].
However, instead of the second combo list populating, I get a parameter request box.
I have the following in the Row Source property for cboAdminCo:
SELECT DISTINCT qryAdminCoFarms.[Admin County]
FROM qryAdminCoFarms
ORDER BY qryAdminCoFarms.[Admin County];
And I get my list of Admin Counties as expected.
I have the following in After Update property of the cboAdminCo combo box:
Private Sub cboAdminCo_AfterUpdate()
On Error Resume Next
cboFarmNo.RowSource = "Select qryAdminCoFarms " & _
"FROM qryAdminCoFarms " & _
"WHERE qryAdminCoFarms.[Admin County] = '" & cboAdminCo.Value & "' " & _
"ORDER BY qryAdminCoFarms.[Farm Number];"
End Sub
However, instead of populating my cboFarmNo with the unique farm numbers for the selected Admin Co, I get a parameter box asking for a farm number.
What do I need to fix/add? Is there another property I need to update?Thanks.
(PS My SQL also includes this code if it matters...
Private Sub cmdRun_Click()
On Error Resume Next
DoCmd.OpenQuery "qryByFarmSelect", acViewNormal, acReadOnly
DoCmd.OpenReport "rptNAP_Production_Report_Farm", acViewPreview
DoCmd.Close acQuery, "qryByFarmSelect", acSaveYes
DoCmd.Close acForm, "frmSelectByFarm"
End Sub
)
My source table is qryAdminCoFarms with columns [Admin County] and [Farm Number].
However, instead of the second combo list populating, I get a parameter request box.
I have the following in the Row Source property for cboAdminCo:
SELECT DISTINCT qryAdminCoFarms.[Admin County]
FROM qryAdminCoFarms
ORDER BY qryAdminCoFarms.[Admin County];
And I get my list of Admin Counties as expected.
I have the following in After Update property of the cboAdminCo combo box:
Private Sub cboAdminCo_AfterUpdate()
On Error Resume Next
cboFarmNo.RowSource = "Select qryAdminCoFarms " & _
"FROM qryAdminCoFarms " & _
"WHERE qryAdminCoFarms.[Admin County] = '" & cboAdminCo.Value & "' " & _
"ORDER BY qryAdminCoFarms.[Farm Number];"
End Sub
However, instead of populating my cboFarmNo with the unique farm numbers for the selected Admin Co, I get a parameter box asking for a farm number.
What do I need to fix/add? Is there another property I need to update?Thanks.
(PS My SQL also includes this code if it matters...
Private Sub cmdRun_Click()
On Error Resume Next
DoCmd.OpenQuery "qryByFarmSelect", acViewNormal, acReadOnly
DoCmd.OpenReport "rptNAP_Production_Report_Farm", acViewPreview
DoCmd.Close acQuery, "qryByFarmSelect", acSaveYes
DoCmd.Close acForm, "frmSelectByFarm"
End Sub
)