I have a combo box on a sub form. Based on the choice, I want another combo box on the sub-sub form to have a selected choice. I've tried to have the choice change the Row Source on the 2nd combo box but I've been unsuccessful.

Both of the combo boxes are bound, so cascading them didn't work.

I'll try any suggestions...

Papap

What do you mean by you want the other combo box to have a selected choice? Do you mean that you want one value to be available in the second combo based on the first selection, or SEVERAL possible values in the second combo based on the selection of the first?

The goal is to have the user make a choice in the first combo box. That choice will dictate which one of the 4 look-up tables or, preferably, queries on those tables becomes the Row Source for the second combo box. I suspect that I'm not using proper addressing in the After Update If statement on the 1st combo box.

The goal is to have the user make a choice in the first combo box. That choice will dictate which one of the 4 look-up tables or, preferably, queries on those tables becomes the Row Source for the second combo box. I suspect that I'm not using proper addressing in the After Update If statement on the 1st combo box.

So what is your current code in the After Update event of the first combo?

Bob:

Below is the code that I've tried.
Parent form: frmParkInfoZone
1st child form: sbfZone4Areas; cboArea
2nd child form: ssubZone4; cboDetail

The choice of Area (4 different areas) will change the Detail combo box Record Source

Thanks for taking a look & your response,

Papa

==============

Private Sub cboArea_AfterUpdate()

    'reset detail list based on Area choice
    If Me.cboArea = "Main St." Then
        Me![frmParkInfoZone4]![sbfZone4Areas]! _
           [ssubZone4]![cboDetail].RecordSource = "qryDetailZ4MainSt"
    ElseIf Me.cboArea = "Windows." Then
        [ssubZone]![cboDetail] = "qryDetailZ4Windows"
    End If
End Sub

You are missing a .Form between the subform (actually, you need to make sure you are referring to the actual subform CONTAINER control that houses the subform on the main form) and combo and since it is on a nested subform, it is easier to use:

Me.Parent.Controls(sbfZone4Areas).Form.Controls(ssubZone4).Form.Controls(cboDetail).RecordSource = "qryDetailZ4MainSt"
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.