Keith Robinson wrote:
Hi Sorry
I'm not explaining myself very well with this problem.
But basically I have a table with a field named "Income".
Each time we pay an employee money, the amount is entered into the
"Income" field. which could look some thing like this..
Income
500
300
1000
150
450 If this column was added up it would come to 2400
We have also created a Form. In this there are two text boxes, one to
add data i.e the amount money I am giving the employee at this time
(this will transfer to the Income field in our table).
in the other text box (named Total Income) I would like the total
income we have give to this employee thoughout the year to appear.
So for example If I give an employee £100, I would then like the Total
Income text box to change from 2400 (as above) to 2500.
Maybe this is not possible.
Check help file for the DSum() function.
=DSum("Income", "YourTableName", "EmployeeID = " & Me.EmployeeID & " AND
PaymentDate > #" & DateSerial(Year(Date())-1, 12, 31) & "#")
Expression explained:
Find the sum of the field [Income] from the table "YourTableName" for the
employee currently displayed on the form and where the date of payment is
greater than December 31st of last year.
Now, I made some assumptions in the example. One is that you have a field that
identifies the employee. I named mine EmployeeID and the expression above
assumes this is a numeric value. If it were text I would need single quote
delimiters around that criteria value similar to the way I used # delimiters
around the date criteria.
Much of the difficulty of setting up a DSum() expression like above is getting
all of the delimiters and quote-breaks correct. If you have trouble post back.
--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com