Results 1 to 4 of 4
  1. #1
    Join Date
    May 2002
    Posts
    28

    Unanswered: Linked combo box (both in subform)

    I was able to successfully implement 2 linked combo boxes as outlined in the following "Data Pig" web tutorial on a single form.

    Macromedia Flash (SWF) Movie Created by Camtasia Studio 2

    However, when I try to implement the same process on a subform, I get an 'Enter parameter value' popup when I click on my second combo box.

    I believe the problem may reside with my row source syntax on my second combo box. It is currently as follows:

    [Forms]![FRM_Facilities]![FRM_Deliverables].[Form].[Combo30]

    My online research indicates I need to use the following syntax:

    [Forms]![MainFormName]![SubFormControlName].[Form].[ControlNameInSubForm]

    Your help would be appreciated. I have attached 2 screen shots of the row source query in my 2 combo boxes.

    Thanks fo your help,

    Susan
    Attached Thumbnails Attached Thumbnails comboBox1.jpg   comboBox2.jpg  

  2. #2
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    If FRM_Facilities is the name of the parent (main) form and FRM_Deliverables is the name of the SubForm/SubReport control (not necessarily the name of the subform: the subform and its container control on the parent form can have two different names) where Combo30 is located, your syntax seems correct. However this will give you a pointer (a handle) to the Combo30 control object or to it's default property. These cannot be a valid RowSource property of another ComboBox.

    It would be easier to dynamically change the RowSource property of the combo in the second subform (let's call it ComboSecond) from the AfterUpdate Event procedure of Combo30 in the first subform:
    Code:
    Private Sub Combo30_AfterUpdate()
        Dim cbo As ComboBox
        Set cbo = Me.Parent.FRM_Deliverables.Form.Controls("ComboSecond")
        cbo.RowSource = "SELECT ... FROM ... WHERE Deliverables_Type = " & Me.Combo30.Value
        ' If Deliverables_Type is not numeric use: WHERE Deliverables_Type = '" & Me.Combo30.Value & "'"
        cbo.Requery
        Set cbo = Nothing
    End Sub
    Have a nice day!

  3. #3
    Join Date
    May 2002
    Posts
    28
    Thanks for you help. Does it make a difference if both combo boxes are on the same form (both on a sub form).?

    I have been away from Access for 5 years....so I am a newbie once again......

    Thanks again for your help.

    Susan

  4. #4
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    If they are on the same (sub)form, it's easier:
    Code:
    Me.ComboSecond.RowSource = "SELECT ... FROM ... WHERE Deliverables_Type = " & Me.Combo30.Value
    Me.ComboSecond.Requery
    Have a nice day!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •