A
AccessIM
I have a table that tracks employee attendance records. In the table, I am
calculating an accumulative total column for points. This took me quite some
time to figure out but I finally did it and it works perfectly but now I am
seeing that using an autonumber field for this purpose is not the best
practice.
Currently, I have created two queries that recreate and renumber the
attendance records every week when the information is uploaded. The first is
a delete query that clears the table and the second is an append query that
re-enters the records in the correct order of EmployeeID and IncidentDate I
need and assigns an consecutive autonumber to each record. Here is the code
for the Append query:
INSERT INTO tblAttendanceDetail (EmployeeID, SSN, INCIDENTDATE, TYPE,
POINTVALUE)
SELECT qryTotalDetail.EmployeeID, qryTotalDetail.SSN,
qryTotalDetail.INCIDENTDATE, qryTotalDetail.TYPE, qryTotalDetail.POINTVALUE
FROM qryTotalDetail
ORDER BY qryTotalDetail.EmployeeID, qryTotalDetail.INCIDENTDATE DESC;
One other point, qryTotalDetail is a union query which pulls information
from four different tables.
Can anyone shed some light on creating a custom counter to a query to
possibly eliminate some of these steps? I have spent the morning reading and
trying different things but with no success. I am a beginner with writing
code so be gentle please. Thank you so much!
calculating an accumulative total column for points. This took me quite some
time to figure out but I finally did it and it works perfectly but now I am
seeing that using an autonumber field for this purpose is not the best
practice.
Currently, I have created two queries that recreate and renumber the
attendance records every week when the information is uploaded. The first is
a delete query that clears the table and the second is an append query that
re-enters the records in the correct order of EmployeeID and IncidentDate I
need and assigns an consecutive autonumber to each record. Here is the code
for the Append query:
INSERT INTO tblAttendanceDetail (EmployeeID, SSN, INCIDENTDATE, TYPE,
POINTVALUE)
SELECT qryTotalDetail.EmployeeID, qryTotalDetail.SSN,
qryTotalDetail.INCIDENTDATE, qryTotalDetail.TYPE, qryTotalDetail.POINTVALUE
FROM qryTotalDetail
ORDER BY qryTotalDetail.EmployeeID, qryTotalDetail.INCIDENTDATE DESC;
One other point, qryTotalDetail is a union query which pulls information
from four different tables.
Can anyone shed some light on creating a custom counter to a query to
possibly eliminate some of these steps? I have spent the morning reading and
trying different things but with no success. I am a beginner with writing
code so be gentle please. Thank you so much!