Results 1 to 8 of 8
  1. #1
    5 Star Lounger
    Join Date
    May 2003
    Location
    Sheffield, Yorkshire
    Posts
    951
    Thanks
    1
    Thanked 0 Times in 0 Posts

    DSum on Change (2003)

    I have a subform in a form, where the users enter weights for alloy. I have put a control on the subform that gives me a running total of alloy used, using

    =DSum("[Alloy Weight]","tblDetails","[ID] <= Forms![frmLog]![ID]").

    The problem I have, is that I have been asked for the totals to change, when the Alloy changes eg

    Alloy Alloy Wt Total
    C111 23.00 23.00
    C111 15.00 38.00
    C111 10.60 48.60
    C112 17.00 17.00

    I the only way the form and subform are linked is by the ID, so I don't know how to achieve the above.

  2. #2
    2 Star Lounger
    Join Date
    Feb 2003
    Location
    Warwick, Warwickshire, England
    Posts
    189
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: DSum on Change (2003)

    Couldn't you just run a requery after the update of the alloy field?

  3. #3
    5 Star Lounger
    Join Date
    May 2003
    Location
    Sheffield, Yorkshire
    Posts
    951
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: DSum on Change (2003)

    I'm not sure I understand. Re-query what?

  4. #4
    2 Star Lounger
    Join Date
    Feb 2003
    Location
    Warwick, Warwickshire, England
    Posts
    189
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: DSum on Change (2003)

    In the after update event of the alloy field, enter the command docmd.requery "Forms!Mainform!SubForm!Total - or whatever the reference is to the running total you are trying to update

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

    Re: DSum on Change (2003)

    What do ID and Alloy have to do with each other?

  6. #6
    5 Star Lounger
    Join Date
    May 2003
    Location
    Sheffield, Yorkshire
    Posts
    951
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: DSum on Change (2003)

    The ID on the Main form and ID on the subform are linked. The idea of the form is like a log book. The user enters his name on the Main form, and details are entered on the Subform, so we can have multiple entries on one day. ID and Alloy are not linked, that is my problem.

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

    Re: DSum on Change (2003)

    It would be easier to do this in a (sub)report grouped by Alloy. You could set the Running Sum property of the total text box to Over Groups.
    Forms aren't really suitable for this.

  8. #8
    5 Star Lounger
    Join Date
    May 2003
    Location
    Sheffield, Yorkshire
    Posts
    951
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: DSum on Change (2003)

    Thanks Hans. Looks like that's what I'll have to do. The users have to fill in a card of how much of the alloys they have used during the shift. I suppose, I could put a button on the form to run the report for just that period.

Posting Permissions

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