Results 1 to 14 of 14

Thread: Filter subform

  1. #1
    Join Date
    Sep 2003
    Posts
    8

    Unanswered: Filter subform

    HI, I have a subform that is linked to another subform that is linked to a main form.

    I have a field that is in the main form called product code. The field on the last subform is Ingrd Code.

    I need to get a list of ingrdcode (located in the bottom subform) for a specific productcode. That product code is the primary key in the main form.

    Here is my query for the IngrdCode field ( in the bottom subform):
    SELECT dbo_ProductIngred.IngrdCode, dbo_Ingredient.IngrdDesc
    FROM dbo_Ingredient INNER JOIN dbo_ProductIngred ON dbo_Ingredient.IngrdCode = dbo_ProductIngred.IngrdCode
    WHERE (((****dbo_ProductIngred.ProductCode)=[frmmspproductCode]![productCode]));

    I know this is not right.

    ****This is the problem area. I need to pass parameters to the subform from the main form, I need to pass the product code so the subwill know which product code to work with. I have not idea how or where to do this.

    I am having a heck of a time describing this. Please help. If there is anything you need to know I will be glad to help.

  2. #2
    Join Date
    Sep 2003
    Posts
    8

    Re: Filter subform

    Question:

    Is this a form within a form within a form?
    or
    one main form that has two separate subforms on it?

  3. #3
    Join Date
    Sep 2003
    Posts
    8

    Filter Subform

    It is a form within a form within a form

    Here is how it is releated

    1. MainformName: frmMSPProduct
    2. SubForm: frmMixing
    3. SubForm: FrmMixingIngredients

    Mainform is related to frmMixing by Product Code

    frmMixing is releated to frmMixingIngredients by MixingID

    On the frmMixingIngredients there is a combolist that lets the user choose the ingredients that get assigned to the mixing ID (2nd form). When the user clicks on the combo list they only want to only see the ingredinets that are assigned to the mainform versus the entire ingredients form. I have a table called productingrd table where the ingredients get assigned to a product code this is the table I am query from to get all the ingredinets assigned to particular product code.

  4. #4
    Join Date
    Sep 2003
    Posts
    8

    Re: Filter Subform

    Just want to make sure I got this right. You have a combo box that you want limited based on information from the main form?

  5. #5
    Join Date
    Sep 2003
    Posts
    8

    Filter Subform

    Yes.

  6. #6
    Join Date
    Sep 2003
    Posts
    8

    Re: Filter Subform

    One more question. Are you using .mdb or .adp Access format?

  7. #7
    Join Date
    Sep 2003
    Posts
    8
    mdb

  8. #8
    Join Date
    Sep 2003
    Posts
    8

    Re: Filter Subform

    Originally posted by JohnnyJr
    It is a form within a form within a form

    Here is how it is releated

    1. MainformName: frmMSPProduct
    2. SubForm: frmMixing
    3. SubForm: FrmMixingIngredients

    Mainform is related to frmMixing by Product Code

    frmMixing is releated to frmMixingIngredients by MixingID

    On the frmMixingIngredients there is a combolist that lets the user choose the ingredients that get assigned to the mixing ID (2nd form). When the user clicks on the combo list they only want to only see the ingredinets that are assigned to the mainform versus the entire ingredients form. I have a table called productingrd table where the ingredients get assigned to a product code this is the table I am query from to get all the ingredinets assigned to particular product code.
    I have got a couple of ideas.
    I would try this first.
    In the query that the combo box is based on in the 'Criteria' of the column Product Code put something like this
    forms!frmMixing!ProductCode

  9. #9
    Join Date
    Sep 2003
    Posts
    8
    Ok.

    I tried this, and it gives me the same results. I get prompted for a value and then when I enter the value it pulls up the apprioate ingredients for that product.

    When I do this from the mainform, I get the same results.

    If that was my only solution, I guess it would work, but the problem is when I go to the next record, it does prompt me to enter a new value for the mixing instructions it keeps the previous vaule.

    Do you think there is a better way to do this?

  10. #10
    Join Date
    Sep 2003
    Posts
    8
    Yeah, that is not right. Does the user not pick on the main form the value they want to see? And is this value bound to a particular text box?

  11. #11
    Join Date
    Sep 2003
    Posts
    8
    Yeah, they pick the product code from the mainform. The product code is bound to the text box in the main form. I think I need to rethink this.

  12. #12
    Join Date
    Sep 2003
    Posts
    8
    Sorry, have to fly......Guess is the product code on the main form is not bound to a particular field weither it be a text box or combo box and it needs to be. If it is a combo box look in the properties of the combo box and make sure you are binding to the product code not the description.

    As far as it not prompting you again In the 'got focus' event I would do something like me.requery in the code.

    sorry couldn't help out more.

  13. #13
    Join Date
    Sep 2003
    Posts
    8
    Thanks, anyway.

  14. #14
    Join Date
    Sep 2003
    Posts
    8
    Thanks, anyway.

Posting Permissions

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