Results 1 to 4 of 4
  1. #1
    New Lounger
    Join Date
    Nov 2002
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Using subform control values in a mainform (A2000)

    I need to display (and sum) a numeric value, from a calculated control in a sub form, in the main form.
    The control is a simple sum of values displayed in the subform. I would like to combine them with a total from the main form's query.
    I have tried things like =[forms]![subformname]![subformvalue] but it doesn't seem to work.
    Do I have to set up parent and child relationships between the main and sub forms?
    Any help appreciated! Thanks.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Using subform control values in a mainform (A2000)

    You shouldn't use [Forms]! here - the Forms collection contains all opened main forms. Subforms are not open, even if the main form they are on is open.

    Also, make sure that subformname is the name of the subform control on the main form. This is not necessarily the same as the name of the subform in the database window.

    So try =[subformname]![subformvalue], or if that doesn't work, =[subformname].[Form].[subformvalue]

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Using subform control values in a mainform (A2000)

    For a comprehensive overview of how to refer to controls and properties of subforms, see Forms: Refer to Form and Subform properties and controls on Dev Ashish's Access Web.

  4. #4
    New Lounger
    Join Date
    Nov 2002
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Using subform control values in a mainform (A2000)

    Hans,

    Thanks for your help. I've been able to successfully reference data from sub forms now.

    Thank you

    Jon

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •