Use requery to get total of a subform

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jacc14
    New Member
    • Jun 2007
    • 116

    Use requery to get total of a subform

    Hi.
    I have tried every avenue such as REQUERY, REPAINT, REFRESH but nothing seems to work. Basically i have a subform with a list of values. at the end of the list there is another subform with all these added together by doing a query to show the sum.

    I have created a button which will refresh the totals subform when i want. However i dont want this as I want the totals to refresh everytime I add a new record ( I presume on the After update event.) Nothing works.

    I have attached my example

    Thanks
    Jacc14
    Attached Files
  • patjones
    Recognized Expert Contributor
    • Jun 2007
    • 931

    #2
    Let me know if my modification works for you. I removed the second subform and command button as I think they are not necessary in your situation. The AfterUpdate event for the first subform is the way to go.

    Pat
    Attached Files

    Comment

    • jacc14
      New Member
      • Jun 2007
      • 116

      #3
      Originally posted by zepphead80
      Let me know if my modification works for you. I removed the second subform and command button as I think they are not necessary in your situation. The AfterUpdate event for the first subform is the way to go.

      Pat
      Hi There. thank you for this. Works perfect for my value field which is input direct into the table. However I intend to add a calculated field to my query and also sum this as well. This means it wont actual be a value held in the table. Is there anything similar i can do but from the query instead.

      Thanks
      Christine

      Comment

      • munkee
        Contributor
        • Feb 2010
        • 374

        #4
        Originally posted by jacc14
        Hi There. thank you for this. Works perfect for my value field which is input direct into the table. However I intend to add a calculated field to my query and also sum this as well. This means it wont actual be a value held in the table. Is there anything similar i can do but from the query instead.

        Thanks
        Christine
        You can use DSum with a query also Christine.

        Comment

        • patjones
          Recognized Expert Contributor
          • Jun 2007
          • 931

          #5
          I should point out that a query can be used as the domain in the second argument of DSum instead of a table. If you are going to base everything off a single query you should still be able to set the text box value to the DSum lookup.

          Pat

          Comment

          • jacc14
            New Member
            • Jun 2007
            • 116

            #6
            Dear Pat / Munkee

            Result. I have dragged the figures in from the query. Thanks both for your assistance.

            Christine

            Comment

            Working...