Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2006
    Posts
    2

    Form/Subform - Update control help!

    Hello all,
    I'm in the process of creating an inventory database and have encountered a significant road block.
    I have a form/subform problem where I have a combo box called "Supplier" on the main form, and I have products (another combobox) in the subform.
    I'm trying to get ONLY the products of the selected supplier (in the main form) to show in the combobox of products in the subform.
    I was able to accomplish this (update products based on supplier), within the same form, but cannot accomplish this when dealing with a form/subform.


    I'm not too familiar with VB or SQL code, so please help solve my problem step by step !!!
    Thanks so much.

  2. #2
    Join Date
    Feb 2006
    Posts
    4

    Re: Form/Subform - Update control help!

    Quote Originally Posted by f_ali
    Hello all,
    I'm in the process of creating an inventory database and have encountered a significant road block.
    I have a form/subform problem where I have a combo box called "Supplier" on the main form, and I have products (another combobox) in the subform.
    I'm trying to get ONLY the products of the selected supplier (in the main form) to show in the combobox of products in the subform.
    I was able to accomplish this (update products based on supplier), within the same form, but cannot accomplish this when dealing with a form/subform.
    I'm not too familiar with VB or SQL code, so please help solve my problem step by step !!!
    Thanks so much.
    Any ideas how to get it done please, I have the same problem.

  3. #3
    Join Date
    Feb 2006
    Posts
    2

    THE ANSWER!

    You need to have the Row Source of the subform's combo box be a query that uses the main form's combo box as a criterion value:

    SELECT * FROM TableName WHERE Fieldname = Forms!MainFormName!ComboBoxName

    where MainFormName is the name of the main form, and ComboBoxName is the name of the combo box control on the main form.

    Then, in the AfterUpdate event of the main form's combo box, you should run simple VBA code that requeries the subform's combo box:

    Private Sub ComboBoxName_AfterUpdate()
    Me!SubformName!SubFormComboBoxName.Requery
    End Sub

    where SubformName is the name of the subform control (the control that holds the subform object) and ComboBoxName is the name of the combo box in the subform


    *Thanks to Ken (MS ACCESS MVP, UA VIP ) - the source of this answer

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 2
    Last Post: 11-25-2013, 10:56 AM
  2. Can't reference control in subform
    By evanscamman in forum Forms
    Replies: 0
    Last Post: 12-25-2007, 06:47 PM
  3. Sending control to specific control
    By wasim_sono in forum Programming
    Replies: 2
    Last Post: 04-19-2007, 08:19 AM
  4. Linked control in form
    By Zipster1967 in forum Forms
    Replies: 0
    Last Post: 04-14-2007, 01:40 PM
  5. Form with subform
    By grgerhard in forum Forms
    Replies: 0
    Last Post: 04-10-2006, 10:28 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums