• LinkMasterFields (A2K)

    Author
    Topic
    #446897

    I have an unbound form that is opened via another form using OpenArgs. There are 5 choices from the OpenArgs. Depending on the OpenArg, the recordsource is assigned to the the unbound form.

    I have a NOTES form that I want to use as a subform. This however, requires the MASTER and CHILD links. How can I set the MASTER and CHILD in the OpenArgs to an unbound form?

    Viewing 0 reply threads
    Author
    Replies
    • #1087801

      Will the Link Master Fields and Link Child Fields properties be the same for all choices? If so, try the following:
      – Open the main form in design view.
      – Temporarily set the Record Source property to one of the possible valid record sources,
      – Set the Link Master Fields and Link Child Fields properties of the subform.
      – Clear the Record Source property of the main form.
      – Save and close the main form.

      Or do you need to change the field names depending on the OpenArgs?

      • #1087804

        The MASTER and CHILD will be the same no matter what is selected from the OpenArgs.

        I will give you suggestion a try and let you know the outcome.

      • #1087806

        Just tried your suggestion. It worked as long as the form was bound. Once Unbound, I recieved the “Enter Parameter Value” requesting “pkProjectNumID”. However, it will return the correct records for both the Main and Sub.

        • #1087809

          Which event do you use to set the Record Source?

          • #1087810

            From a form in an AfterUpdate event each of the 5 controls, I have

            1. DoCmd.OpenForm FormName:=”frm_IssueReview”, OpenArgs:=”LOB”
            or
            2. DoCmd.OpenForm FormName:=”frm_IssueReview”, OpenArgs:=”Status”
            or
            3. DoCmd.OpenForm FormName:=”frm_IssueReview”, OpenArgs:=”Issue”
            etc.

            Then In the OnLoad event of the unbound form I have:
            If OpenArgs = “LOB” Then
            Me.RecordSource = “qry_IssueReview_By_LOB”
            End If

            If OpenArgs = “Issue” Then
            Me.RecordSource = “qry_IssueReview_By_IssueType”
            End If

            If OpenArgs = “Status” Then
            Me.RecordSource = “qry_IssueReview_By_Status”
            End If

            • #1087812

              Try using the On Open event of the unbound form instead of the On Load event.

            • #1087817

              Did that already….no luck either.

              I find it odd that it will ask for the parameter value yet return the correct recordset and and link both MASTER and CHILD w/o a response from me.

            • #1087821

              OK, then you’ll have to leave the Link Master Fields and Link Child Fields properties blank in design view, and set them in the On Open or On Load event AFTER setting the record source of the form:

              Me.SubformName.LinkMasterFields = “SomeField”
              Me.SubformName.LinkChildFields = “SameOrOtherField”

            • #1087826

              That did it…….O….Thank you Hans

    Viewing 0 reply threads
    Reply To: LinkMasterFields (A2K)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: