G
Guest
I am new to access...I am need of help!! I have been working on this project
for about a month trying to get it to work. This is the problem I am trying
to get the sum for a field: totpointsaccessed. Example: Albert has two
reports in the first report he receive 2 points and in the second report he
receive 1 point, now I am trying to get the total for the points Albert
receive which should be 3 points, I am getting 0. I have tried
=Sum([totalpointsaccessed]) and =Sum(IIf([pointsaccessed]= "total points
accessed",1,0) but it does not work. i went to the query to calculated the
field there but when I hit the E and use my total field as Sum I can not add
any record to the form....any help would be appreciated. Just to keep you
inform with what I have done here is my SQL:
SELECT [tbl Employee Accident].AccidentID, [tbl Employee
Accident].EmployeeID, [tbl Employee Accident].Name, [tbl Employee
Accident].Address, [tbl Employee Accident].City, [tbl Employee
Accident].Zipcode, [tbl Employee Accident].DOB, [tbl Employee Accident].[Date
Hired], [tbl Employee Accident].Department, [tbl Employee Accident].Jobtitle,
[tbl Accidents].[Location of accident], [tbl Accidents].[Date of accident],
[tbl Accidents].[Time of accident], [tbl Accidents].[Time workday began],
[tbl Accidents].[Date employer notified], [tbl Accidents].[Did employee work
the next day], [tbl Accidents].[Type of Injury], [tbl Accidents].[Part of
body affected], [tbl Accidents].Summary, [tbl Accidents].[Treating
Physician], [tbl Accidents].[Treating Hospital], [tbl Accidents].[No
treatment], [tbl Accidents].[Minor:by employer], [tbl Accidents].[Minor:by
clinic/hospital], [tbl Accidents].[Emergency care], [tbl
Accidents].[Hospitalized>24hrs], [tbl Accidents].[Report prepared by], [tbl
Accidents].Position, [tbl Accidents].Telephone, [tbl Accidents].[Date of
report], [tbl Accidents].[Points Accessed], [tbl Accidents].Avoidable, [tbl
Accidents].Unavoidable, Sum([tbl Total Accidents].[Total by Employee]) AS
[SumOfTotal by Employee], Sum([tbl Total Accidents].[Total by Department]) AS
[SumOfTotal by Department], Sum([tbl Total Accidents].[Total points
accessed]) AS [SumOfTotal points accessed]
FROM [tbl Accidents] LEFT JOIN ([tbl Employee Accident] LEFT JOIN [tbl Total
Accidents] ON [tbl Employee Accident].AccidentID = [tbl Total
Accidents].AccidentID) ON [tbl Accidents].AccidentID = [tbl Employee
Accident].AccidentID
GROUP BY [tbl Employee Accident].AccidentID, [tbl Employee
Accident].EmployeeID, [tbl Employee Accident].Name, [tbl Employee
Accident].Address, [tbl Employee Accident].City, [tbl Employee
Accident].Zipcode, [tbl Employee Accident].DOB, [tbl Employee Accident].[Date
Hired], [tbl Employee Accident].Department, [tbl Employee Accident].Jobtitle,
[tbl Accidents].[Location of accident], [tbl Accidents].[Date of accident],
[tbl Accidents].[Time of accident], [tbl Accidents].[Time workday began],
[tbl Accidents].[Date employer notified], [tbl Accidents].[Did employee work
the next day], [tbl Accidents].[Type of Injury], [tbl Accidents].[Part of
body affected], [tbl Accidents].Summary, [tbl Accidents].[Treating
Physician], [tbl Accidents].[Treating Hospital], [tbl Accidents].[No
treatment], [tbl Accidents].[Minor:by employer], [tbl Accidents].[Minor:by
clinic/hospital], [tbl Accidents].[Emergency care], [tbl
Accidents].[Hospitalized>24hrs], [tbl Accidents].[Report prepared by], [tbl
Accidents].Position, [tbl Accidents].Telephone, [tbl Accidents].[Date of
report], [tbl Accidents].[Points Accessed], [tbl Accidents].Avoidable, [tbl
Accidents].Unavoidable;
--Thank you
LHEMA
for about a month trying to get it to work. This is the problem I am trying
to get the sum for a field: totpointsaccessed. Example: Albert has two
reports in the first report he receive 2 points and in the second report he
receive 1 point, now I am trying to get the total for the points Albert
receive which should be 3 points, I am getting 0. I have tried
=Sum([totalpointsaccessed]) and =Sum(IIf([pointsaccessed]= "total points
accessed",1,0) but it does not work. i went to the query to calculated the
field there but when I hit the E and use my total field as Sum I can not add
any record to the form....any help would be appreciated. Just to keep you
inform with what I have done here is my SQL:
SELECT [tbl Employee Accident].AccidentID, [tbl Employee
Accident].EmployeeID, [tbl Employee Accident].Name, [tbl Employee
Accident].Address, [tbl Employee Accident].City, [tbl Employee
Accident].Zipcode, [tbl Employee Accident].DOB, [tbl Employee Accident].[Date
Hired], [tbl Employee Accident].Department, [tbl Employee Accident].Jobtitle,
[tbl Accidents].[Location of accident], [tbl Accidents].[Date of accident],
[tbl Accidents].[Time of accident], [tbl Accidents].[Time workday began],
[tbl Accidents].[Date employer notified], [tbl Accidents].[Did employee work
the next day], [tbl Accidents].[Type of Injury], [tbl Accidents].[Part of
body affected], [tbl Accidents].Summary, [tbl Accidents].[Treating
Physician], [tbl Accidents].[Treating Hospital], [tbl Accidents].[No
treatment], [tbl Accidents].[Minor:by employer], [tbl Accidents].[Minor:by
clinic/hospital], [tbl Accidents].[Emergency care], [tbl
Accidents].[Hospitalized>24hrs], [tbl Accidents].[Report prepared by], [tbl
Accidents].Position, [tbl Accidents].Telephone, [tbl Accidents].[Date of
report], [tbl Accidents].[Points Accessed], [tbl Accidents].Avoidable, [tbl
Accidents].Unavoidable, Sum([tbl Total Accidents].[Total by Employee]) AS
[SumOfTotal by Employee], Sum([tbl Total Accidents].[Total by Department]) AS
[SumOfTotal by Department], Sum([tbl Total Accidents].[Total points
accessed]) AS [SumOfTotal points accessed]
FROM [tbl Accidents] LEFT JOIN ([tbl Employee Accident] LEFT JOIN [tbl Total
Accidents] ON [tbl Employee Accident].AccidentID = [tbl Total
Accidents].AccidentID) ON [tbl Accidents].AccidentID = [tbl Employee
Accident].AccidentID
GROUP BY [tbl Employee Accident].AccidentID, [tbl Employee
Accident].EmployeeID, [tbl Employee Accident].Name, [tbl Employee
Accident].Address, [tbl Employee Accident].City, [tbl Employee
Accident].Zipcode, [tbl Employee Accident].DOB, [tbl Employee Accident].[Date
Hired], [tbl Employee Accident].Department, [tbl Employee Accident].Jobtitle,
[tbl Accidents].[Location of accident], [tbl Accidents].[Date of accident],
[tbl Accidents].[Time of accident], [tbl Accidents].[Time workday began],
[tbl Accidents].[Date employer notified], [tbl Accidents].[Did employee work
the next day], [tbl Accidents].[Type of Injury], [tbl Accidents].[Part of
body affected], [tbl Accidents].Summary, [tbl Accidents].[Treating
Physician], [tbl Accidents].[Treating Hospital], [tbl Accidents].[No
treatment], [tbl Accidents].[Minor:by employer], [tbl Accidents].[Minor:by
clinic/hospital], [tbl Accidents].[Emergency care], [tbl
Accidents].[Hospitalized>24hrs], [tbl Accidents].[Report prepared by], [tbl
Accidents].Position, [tbl Accidents].Telephone, [tbl Accidents].[Date of
report], [tbl Accidents].[Points Accessed], [tbl Accidents].Avoidable, [tbl
Accidents].Unavoidable;
--Thank you
LHEMA