Form with 2 subform relying on each other filter not working RRS feed

  • Question

  • I have one main form, with sub two subform

    Sub form 1 filters data as I navigate through main form but sub form 2 is relying on Sub form 1.

    Tried all possible way (NOT through Code) but sub form 2 not filtering data as I select record in sub form 1.

    I am using Access 2016.


    Wednesday, May 22, 2019 8:10 AM

All replies

  • Hi. How exactly did you link sub2 with sub1? Are you using a hidden textbox on the main form?
    Wednesday, May 22, 2019 4:43 PM
  • You might like to take a look at in my public databases folder at:!169

    Note that if you are using an earlier version of Access you might find that the colour of some form objects such as buttons shows incorrectly and you will need to  amend the form design accordingly.

    This little demo file illustrates the use of correlated subforms, using Northwind data as its example.  The second subform is correlated with the first by referencing the key of the first as a parameter:

    SELECT OrderDetails.*
    FROM Products INNER JOIN OrderDetails
    ON Products.ProductID = OrderDetails.ProductID
    WHEREOrderDetails.OrderID = [Forms]![frmCompanies]![frmsubOrders]![OrderID]
    ORDER BY Products.ProductName;

    The second subform is requeried in the Current event procedure of the first.  This reloads the former's recordset, restricting it to those rows where the OrderID column's value is that of the primary key of the latter.

    Ken Sheridan, Stafford, England

    Wednesday, May 22, 2019 5:53 PM