Using DSum

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ckpoll2
    New Member
    • Sep 2006
    • 76

    #1

    Using DSum

    Hello,

    I'm trying to build a text box in a form that will add hours for a two week period. I have created a query to return the hours in the two week range, but the same name and hour type will appear multiple times because of the different dates even though I put the group by function on.

    Is it possible to do a dsum from a query rather than a table in the text box where it will sum the hours where name=x and hour type=y?

    Thanks,

    Charlie
  • PEB
    Recognized Expert Top Contributor
    • Aug 2006
    • 1418

    #2
    So do you want to save in this text box the result information or
    you want a sample calculation field that shows you this information?

    I suppose you want a calculation field!

    So you have to type in the control Source property:

    =Dsum("Hours", "My_query_with_ hours", "Name='" & X & "' AND week=" & str(y))

    Where "Hours" is the field where are stored the hours in your query on which you want to do the sum

    "My_query_with_ hours" is Your query with hours

    AND

    "Name='" & X & "' AND week=" & str(y) is the searching condition

    Take care i've shown you the use of 2 types of values text and numbers

    Name like a variable AS text
    AND week as variable as number!

    Comment

    • ckpoll2
      New Member
      • Sep 2006
      • 76

      #3
      Worked great, thanks for the help!

      Comment

      Working...