• Sub-forms to main form

    Author
    Topic
    #462738

    I am running W7, MSO2003 SP3
    I have a data form for a client that displays, in a sub-form list, if that client has an employment and or a self-employment. The sub-form has a macro button that when clicked opens the main employment or self-employment form. The macro works perfectly when operated directly from the employment or self-employment listings and take me directly to the underlying data form.
    However when it is operated in the sub-form displayed in the clients data form I have to supply the ID of the record to be able to get to the underlying data form. Is there a way to get to the underlying form without having to type in the ID please?

    [SEID]=[Forms]![FrmSelfEmploymentListingShort]![SEID] is what is in the Where box in the macro. The first SEID refers to the selfemploymentdata form, which is where I want to get to.

    Viewing 1 reply thread
    Author
    Replies
    • #1178658

      Your description leaves me totally confused. Could you try to explain that more precisely and clearly? Thanks.

      • #1178670

        Your description leaves me totally confused. Could you try to explain that more precisely and clearly? Thanks.

        Sorry for that Hans.
        Client form displays 2 sub-forms: employment and self-employment. Each has a macro button on them. When the forms are viewed outside of the client form, the macro opens the full record of employment. However when the sub-forms are displyed, the macr makes you enter the ID number to get to the underlying form. Please have a look at the picture.

        • #1178676

          Try setting the Where Condition to

          [SEID]=[Forms]![NameOfMainForm]![FrmSelfEmploymentListingShort]![SEID]

          where NameOfMainForm is the name of the main form.

          Also, FrmSelfEmploymentListingShort must now be the name of the relevant subform as a control on the main form. This is not necessarily the same as the name of the source object. To see the control name, open the main form in design view, click once on the subform and look at the toolbar or at the Properties window to see the control name.

    • #1178981

      Hi Hans,
      Thanks for the information. Part of it worked (that referring to Returns) and the self-employment and employment didn’t.
      The screen snip shows what happens when the button on the sub form is clicked. The button runs the macro in the second snip – which reads
      [SEID]=[Forms]![FrmIndividualDataQuery]![FrmSelfEmploymentListingShort]![SEID]
      Both of the form names are correct.
      The first one I treid worked perfectly:
      [TRRecord]=[Forms]![FrmIndividualDataQuery]![FrmTaxReturnsList]![TRRecord]
      I’d appreciate any help please.

      • #1178984

        Are you absolutely sure that FrmSelfEmploymentListingShort is the name of the subform as a control on FrmIndividualDataQuery?
        And is the name of the control bound to SEID on the subform also SEID?

    Viewing 1 reply thread
    Reply To: Sub-forms to main form

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

    Your information: