Combo Box in Subform

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Penstar
    New Member
    • Apr 2007
    • 8

    Combo Box in Subform

    I have a Combo Box on a Subform which works perfectly when the suborm is opened on its own. However, when I open the Main form Containing the Subform, and try to use the Combo Box it comes up with box "Enter Paramater Value" Forms!KS_Orders Enter_F!KS_Orde rsEnter_SF!Prod uctID.

    Main form Name
    KS_OrdersEnter_ F

    Subform Name
    KS_OrdersEnter_ SF

    Forms Linked by field [OrderID]

    On the Subform Combo Box
    Control Source: PackID (from table OrderDetails)
    Row Source:
    SELECT dbo_PackDetail. PackID, dbo_PackDetail. ProductID, dbo_Pack.PackDe sc
    FROM dbo_Pack RIGHT JOIN dbo_PackDetail ON dbo_Pack.PackID = dbo_PackDetail. PackID
    WHERE (((dbo_PackDeta il.ProductID)=[Forms]![KS_OrdersEnter_ SF]![ProductID]));


    I tried changing Parameter to [Forms]![KS_OrdersEnter_ F]![KS_OrdersEnter_ SF]![ProductID] with no success.


    Penny
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    Originally posted by Penstar
    I have a Combo Box on a Subform which works perfectly when the suborm is opened on its own. However, when I open the Main form Containing the Subform, and try to use the Combo Box it comes up with box "Enter Paramater Value" Forms!KS_Orders Enter_F!KS_Orde rsEnter_SF!Prod uctID.

    Main form Name
    KS_OrdersEnter_ F

    Subform Name
    KS_OrdersEnter_ SF

    Forms Linked by field [OrderID]

    On the Subform Combo Box
    Control Source: PackID (from table OrderDetails)
    Row Source:
    SELECT dbo_PackDetail. PackID, dbo_PackDetail. ProductID, dbo_Pack.PackDe sc
    FROM dbo_Pack RIGHT JOIN dbo_PackDetail ON dbo_Pack.PackID = dbo_PackDetail. PackID
    WHERE (((dbo_PackDeta il.ProductID)=[Forms]![KS_OrdersEnter_ SF]![ProductID]));


    I tried changing Parameter to [Forms]![KS_OrdersEnter_ F]![KS_OrdersEnter_ SF]![ProductID] with no success.


    Penny
    Change:
    Code:
    [Forms]![KS_OrdersEnter_SF]![ProductID]
    To:
    Code:
    [Forms]![KS_OrdersEnter_F]![KS_OrdersEnter_SF].Form.ProductID

    Comment

    • Penstar
      New Member
      • Apr 2007
      • 8

      #3
      I have tried your suggestion. Unfortunately, the Box "Enter Parameter Value" still comes up, now with the new code.

      Comment

      • Rabbit
        Recognized Expert MVP
        • Jan 2007
        • 12517

        #4
        You're going to have to assign the row source AFTER the form has fully loaded. Right now it's loading but the controls haven't all been created and populated so there's nothing for it to get it's value from. I would try it in the On Load event although I don't think that will work. If that doesn't work maybe in the After Update of the control that it's pulling it's data from.

        Comment

        • Penstar
          New Member
          • Apr 2007
          • 8

          #5
          Thanks again!

          After much further mucking about, I found that your initial suggestion was correct. Why it didn't work was that the Subform control in the main form had a slightly different name to to subform. I recreated the subform from scratch, and started combo box from scratch AND IT WORKED!!!

          Originally posted by Rabbit
          You're going to have to assign the row source AFTER the form has fully loaded. Right now it's loading but the controls haven't all been created and populated so there's nothing for it to get it's value from. I would try it in the On Load event although I don't think that will work. If that doesn't work maybe in the After Update of the control that it's pulling it's data from.

          Comment

          • Rabbit
            Recognized Expert MVP
            • Jan 2007
            • 12517

            #6
            Originally posted by Penstar
            Thanks again!

            After much further mucking about, I found that your initial suggestion was correct. Why it didn't work was that the Subform control in the main form had a slightly different name to to subform. I recreated the subform from scratch, and started combo box from scratch AND IT WORKED!!!
            Not a problem.

            Comment

            Working...