none
Use of controls on multiple forms RRS feed

  • Question

  • I have a quite complex Access 2013 database with some stuff built into it that I did not design.  I would like to add to what is in place, but am not wholly sure how to do it.

    There is a form named "5-IPDetailForm"  There is a check box control on the form named "approved" on the form and a control on the form named "ChangeItemOrder", which opens a form named "ChangeItemOrderForm".

    This form contains a control named  "RenumberFromTop" and a subform named "StepOrder".  When you click the "RenumberFromTop" control, is renumbers the records on the subform.  This is all working just fine.

    However they want this to happen automatically when the "Approved" check box on the "5-IPDetailForm" is set to true.

    I think I want to use the after update event on the "5-IPDetailForm" to open the "ChangeItemOrder" form in hidden mode, then somehow activate the "ChangeItemOrderForm", "RenumberFromTop" control.  I don't know how to do all this from the "5-IPDetailForm".  Can anyone suggest how that should be done?

    I hope this explanation makes some sense!

    Tuesday, January 2, 2018 4:35 PM

Answers

  • Hi,

    There are a few ways to accomplish what you want. What you are thinking is one way to do it. To activate or execute the routine from the "RenumberFromTop" control from the "5-IPDetailForm," you might need to change the declaration of the "RenumberFromTop" control to "Public" from "Private."

    Once the routine is declared as "Public," you should be able to call it from the other form.

    Hope it helps...

    • Marked as answer by tkosel Wednesday, January 3, 2018 5:37 PM
    Tuesday, January 2, 2018 4:45 PM
  • You can easily open the ChangeItemOrderForm form with code in the Approved check box's AfterUpdate event procedure, and pass a value to the ChangeItemOrder form via the OpenArgs mechanism:

        Const FORM_NAME = "ChangeItemOrderForm"

        If Me.Approved Then
            DoCmd.OpenForm FORM_NAME, OpenArgs:="RenumberFromTop"
        End If

    You don't say whether the ChangeItemOrderForm is opened filtered to a specific record.  If it is, you'd need to add a string expression to do this as the WhereCondition argument of the OpenForm method in the above .
     
    Then in the ChangeItemOrderForm form's Load event procedure call the Click event procedure of the RenumberFromTop control conditionally with:

        If Me.OpenArgs = "RenumberFromTop" Then
            RenumberFromTop_Click
        End If


    Ken Sheridan, Stafford, England

    • Proposed as answer by Terry Xu - MSFT Wednesday, January 3, 2018 2:12 AM
    • Marked as answer by tkosel Wednesday, January 3, 2018 5:37 PM
    Tuesday, January 2, 2018 9:55 PM

All replies

  • Hi,

    There are a few ways to accomplish what you want. What you are thinking is one way to do it. To activate or execute the routine from the "RenumberFromTop" control from the "5-IPDetailForm," you might need to change the declaration of the "RenumberFromTop" control to "Public" from "Private."

    Once the routine is declared as "Public," you should be able to call it from the other form.

    Hope it helps...

    • Marked as answer by tkosel Wednesday, January 3, 2018 5:37 PM
    Tuesday, January 2, 2018 4:45 PM
  • You can easily open the ChangeItemOrderForm form with code in the Approved check box's AfterUpdate event procedure, and pass a value to the ChangeItemOrder form via the OpenArgs mechanism:

        Const FORM_NAME = "ChangeItemOrderForm"

        If Me.Approved Then
            DoCmd.OpenForm FORM_NAME, OpenArgs:="RenumberFromTop"
        End If

    You don't say whether the ChangeItemOrderForm is opened filtered to a specific record.  If it is, you'd need to add a string expression to do this as the WhereCondition argument of the OpenForm method in the above .
     
    Then in the ChangeItemOrderForm form's Load event procedure call the Click event procedure of the RenumberFromTop control conditionally with:

        If Me.OpenArgs = "RenumberFromTop" Then
            RenumberFromTop_Click
        End If


    Ken Sheridan, Stafford, England

    • Proposed as answer by Terry Xu - MSFT Wednesday, January 3, 2018 2:12 AM
    • Marked as answer by tkosel Wednesday, January 3, 2018 5:37 PM
    Tuesday, January 2, 2018 9:55 PM