Sum Entries

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • MyWaterloo
    New Member
    • Dec 2007
    • 135

    #1

    Sum Entries

    How do I sum entries? I am working on a form that keeps track of employee hours by labeling each day worked with a letter. "W" for work, "V" for vacation, etc. What I need to do is be able to add all the W's (say, each W equaling 8) and all the V's. Any suggestions?

    Thanks
  • ChipR
    Recognized Expert Top Contributor
    • Jul 2008
    • 1289

    #2
    If your table has fields like Day, W(number), V(number) then in the footer of the form, you can put a text box with the source
    =Sum([W]) + Sum([V])

    Comment

    • MyWaterloo
      New Member
      • Dec 2007
      • 135

      #3
      Originally posted by ChipR
      If your table has fields like Day, W(number), V(number) then in the footer of the form, you can put a text box with the source
      =Sum([W]) + Sum([V])
      My table has fields for each day of the week. My company uses a simple letter code representing the time used that day. W = Regular 8 hour work day, V = Vacation, S = Sick, P = Personal. In the fields for each day of the week will be a letter. On my form I want to be able to add the total of different letters. If I have 5 V's I want to be able to show that numerically in an unbound text box. The figure in the text box is then applied to a field used to keep track of vacation time in the on close event of the form.

      Comment

      • ChipR
        Recognized Expert Top Contributor
        • Jul 2008
        • 1289

        #4
        Tricky. Take a look at DCount


        I think maybe you'd have to do
        DCount("Monday" , "MyTable", "LetterCode = 'W') + _
        DCount("Tuesday ", "MyTable", LetterCode = 'W') + _
        DCount("Wednesd ay", "MyTable", "LetterCode='W' ) + etc.

        But depending on what's in your table, you maybe have
        "LetterCode ='W' AND EmployeeNumber = " & EmployeeID & " AND WeekNumber = " & WeekNumber

        That's how I'm doing it right now, but maybe someone has a better answer now that we have a little more info?

        Comment

        • MyWaterloo
          New Member
          • Dec 2007
          • 135

          #5
          Originally posted by ChipR
          Tricky. Take a look at DCount


          I think maybe you'd have to do
          DCount("Monday" , "MyTable", "LetterCode = 'W') + _
          DCount("Tuesday ", "MyTable", LetterCode = 'W') + _
          DCount("Wednesd ay", "MyTable", "LetterCode='W' ) + etc.

          But depending on what's in your table, you maybe have
          "LetterCode ='W' AND EmployeeNumber = " & EmployeeID & " AND WeekNumber = " & WeekNumber

          That's how I'm doing it right now, but maybe someone has a better answer now that we have a little more info?

          Thanks ChipR. I'll follow your lead and give it a try.

          Comment

          Working...