Sum a Record

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I wrote an absentee point system program and am trying to calculate how many
points an employee has. I am using the following code in the form and it
works.

However, I would also like to add the current points on the screen to the
sum of the points in the table. I tried to say "[point] + Me.points", but it
won't accept this. Any thoughts.

Dim nPoints As Integer
strEmp = Me.employee_no
Me.Text35 = DSum("[points]", "ABSTRX", "[employee_no]=" & strEmp)
 
That worked. Thanks!

Ofer said:
Try this

Me.Text35 = DSum("[points]", "ABSTRX", "[employee_no]=" & strEmp) + Me.Points


--
The next line is only relevant to Microsoft''s web-based interface users.
If I answered your question, please mark it as an answer. It''s useful to
know that my answer was helpful
HTH, good luck


tonyak said:
I wrote an absentee point system program and am trying to calculate how many
points an employee has. I am using the following code in the form and it
works.

However, I would also like to add the current points on the screen to the
sum of the points in the table. I tried to say "[point] + Me.points", but it
won't accept this. Any thoughts.

Dim nPoints As Integer
strEmp = Me.employee_no
Me.Text35 = DSum("[points]", "ABSTRX", "[employee_no]=" & strEmp)
 
One addition -- watch out for nulls! Use Nz() to convert nulls to
zeroes so that null doesn't propagate through the addition.

Me.Text35 = Nz(DSum("[points]", "ABSTRX", "[employee_no]=" & strEmp)) +
Nz(Me.Points)

HTH,

Kevin
That worked. Thanks!

:

Try this

Me.Text35 = DSum("[points]", "ABSTRX", "[employee_no]=" & strEmp) + Me.Points


--
The next line is only relevant to Microsoft''s web-based interface users.
If I answered your question, please mark it as an answer. It''s useful to
know that my answer was helpful
HTH, good luck


:

I wrote an absentee point system program and am trying to calculate how many
points an employee has. I am using the following code in the form and it
works.

However, I would also like to add the current points on the screen to the
sum of the points in the table. I tried to say "[point] + Me.points", but it
won't accept this. Any thoughts.

Dim nPoints As Integer
strEmp = Me.employee_no
Me.Text35 = DSum("[points]", "ABSTRX", "[employee_no]=" & strEmp)
 
Back
Top