Hi everyone,
I'm trying to create a cascading combo box on a form and I'm really stuck. I've followed several guides, but I must be missing something simple.
My GoalOn my form frmPlumEvaluations, I want the user to:
- Select an IPOwner from a combo box (cboIPOwner).
- Have the PlantID combo box (cboPlantID) filter to show only the plants for that owner.
- When a PlantID is selected, the Cultivar and Block controls should auto-populate.
What I've DoneMy form, frmPlumEvaluations, has its Record Source property set to a table named tblPlum. This is the table the form saves data to.
I've named my controls on the form as follows:
- IP Owner Combo Box: cboIPOwner
- PlantID Combo Box: cboPlantID
- Cultivar Combo Box: cboCultivar
SQL for the PlantID Combo Box (cboPlantID)I've set the Row Source for cboPlantID to:
SQL
SELECT DISTINCT PlantID
FROM tblPlum
WHERE IPOwner = [Forms]![frmPlumEvaluations]![cboIPOwner]
ORDER BY PlantID;
VBA CodeIn the After Update event for the cboIPOwner combo box, I have this code:
VBA
Private Sub cboIPOwner_AfterUpdate()
Me.cboPlantID = Null
Me.cboCultivar = Null
Me.cboBlock = Null
Me.cboPlantID.Requery
End Sub
And in the After Update event for the cboPlantID combo box, I have this:
VBA
Private Sub cboPlantID_AfterUpdate()
If Not IsNull(Me.cboPlantID) Then
Me.cboCultivar = DLookup("Cultivar", "tblPlum", "PlantID = '" & Me.cboPlantID & "'")
Me.cboBlock = DLookup("Block", "tblPlum", "PlantID = '" & Me.cboPlantID & "'")
End If
End Sub
The ProblemNo matter what I do, when I click the dropdown for the PlantID combo box, I get the "Enter Parameter Value" popup asking for Forms!frmPlumEvaluations!cboIPOwner.
I have double- and triple-checked that my form is named frmPlumEvaluations and the control is named cboIPOwner. I even checked for case sensitivity.
I feel like I'm so close but I just can't see the mistake. Any help or suggestions would be hugely appreciated!
Some SAMPLE DATA:
Code:PlantID Cultivar IPOwner IP Eienaar BlockAP0482 G.969 1179 Cornell Center for Technology Enterprise T7B G6969 AP0482 G.969 1179 Cornell Center for Technology Enterprise T8 G969 AP0482 G.969 1179 Cornell Center for Technology Enterprise T8 G969 AP0390 G.969 1179 Cornell Center for Technology Enterprise TC G6969