none
add 2 subforms in another subform in contineous mode RRS feed

  • Question

  • Good day,

    I have a form named "frmDétails commande" on which I have a subform named "sbfActiveOrders" on that subform I would like to see the value of 2 other suforms named "frmParTableCompteBar" and "frmParTableCompteCuisine" the fields are respectively "CompteBar" and "CompteCuisine"

    Because I absolutely need my first subform to be contineous, it seems that I can't add the 2 last subforms, I tried to add 2 indépendants fields and link them to the fields of the 2 subforms but even if they are linked with the Réf commande field, all these 2 indépendants fields reflects only one order at the time.

    Here an image to help…

    Thanks for your suggestion, this is not an easy one or is it feasible all together?

    Wednesday, April 3, 2019 4:58 PM

Answers

  • Hi. You can either put the two other subforms outside of the continuous subform and synchronize them or use datasheet view for your continuous subform and turn on subdatasheets.
    Wednesday, April 3, 2019 5:46 PM
  • You'll find an example of correlated subforms in CorrelatedSubs.zip in my public databases folder at:

    https://onedrive.live.com/?cid=44CC60D7FEA42912&id=44CC60D7FEA42912!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 uses Northwind data as its example, correlating a continuous orders subform with a continuous order details subform, so that, as the user navigates form row to row in the first the second is requeried to show the order details relating to the currently selected order.

    The way it works is that the second subform's query includes a reference to the first subform's primary key as a parameter.  In the first subform's Current event procedure the second subform is requeried.  There is no reason of course why two subforms cannot be correlated with the first subform in this way.

    You'll sometimes see subforms correlated by means of a hidden control in the parent form whose ControlSource property references the primary key of the first subform.  The hidden control is then referenced as the LinkMasterFields property of the second subform control.  However, this method is noticeably slower than using a parameter in the second subform's query.

    Ken Sheridan, Stafford, England

    Wednesday, April 3, 2019 9:02 PM

All replies

  • Hi. You can either put the two other subforms outside of the continuous subform and synchronize them or use datasheet view for your continuous subform and turn on subdatasheets.
    Wednesday, April 3, 2019 5:46 PM
  • I will try that and comeback, thanks for your suggestion

    Claude

    Wednesday, April 3, 2019 6:09 PM
  • Hi Claude. You're welcome. Let us know how it goes. When I said "synchronize," I was referring to using VBA code. There are some examples on how to do that if you search for it. Cheers!
    Wednesday, April 3, 2019 6:34 PM
  • You'll find an example of correlated subforms in CorrelatedSubs.zip in my public databases folder at:

    https://onedrive.live.com/?cid=44CC60D7FEA42912&id=44CC60D7FEA42912!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 uses Northwind data as its example, correlating a continuous orders subform with a continuous order details subform, so that, as the user navigates form row to row in the first the second is requeried to show the order details relating to the currently selected order.

    The way it works is that the second subform's query includes a reference to the first subform's primary key as a parameter.  In the first subform's Current event procedure the second subform is requeried.  There is no reason of course why two subforms cannot be correlated with the first subform in this way.

    You'll sometimes see subforms correlated by means of a hidden control in the parent form whose ControlSource property references the primary key of the first subform.  The hidden control is then referenced as the LinkMasterFields property of the second subform control.  However, this method is noticeably slower than using a parameter in the second subform's query.

    Ken Sheridan, Stafford, England

    Wednesday, April 3, 2019 9:02 PM
  • Thanks Ken, everything is working fine now, you direct me in the right direction...Super !

    Thursday, April 4, 2019 9:10 AM
  • Very interesting, this datasheet view, thanks for your answer

    Claude

    Thursday, April 4, 2019 9:11 AM
  • Very interesting, this datasheet view, thanks for your answer

    Claude


    Hi Claude. You're welcome. Ken and I were happy to assist. Good luck with your project.
    Friday, April 5, 2019 4:05 PM