Do you care only about the monthnumber or the month and year? How does this related to the order >of LastName and KeyCode?
Oh gee...I didn't think about any of that. What I would like to see are the
requests ordered by month and key code. Normally, it's the code I'm trying to
find. Based on your questions, I changed the query. I took out the names so
that I wouldn't see repeating data. I moved the labels to the ReqstMonth
header.
Here's the new SQL:
SELECT tblKeysRequests.EmpID, tblEmployees.EmployeeType, tblKeys.KeyID,
tblKeys.KeyCode, tblKeysRequests.RqstDate, tblKeysRequests.QtyRequested,
tblKeysRequests.RcvdDate, tblKeysRequests.QtyRecd, tblKeysRequests.Reason,
Format$([RqstDate],"mmmm") AS RqstMonth
FROM tblKeys INNER JOIN (tblEmployees INNER JOIN tblKeysRequests ON
tblEmployees.EmpID = tblKeysRequests.EmpID) ON tblKeys.KeyID =
tblKeysRequests.KeyID
GROUP BY tblKeysRequests.EmpID, tblEmployees.EmployeeType, tblKeys.KeyID,
tblKeys.KeyCode, tblKeysRequests.RqstDate, tblKeysRequests.QtyRequested,
tblKeysRequests.RcvdDate, tblKeysRequests.QtyRecd, tblKeysRequests.Reason,
Format$([RqstDate],"mmmm"), [FirstName] & " " & [LastName], tblEmployees.
FirstName, tblEmployees.LastName
HAVING (((tblEmployees.EmployeeType)<>2) AND (Not (tblKeysRequests.RcvdDate)
Is Null))
ORDER BY tblKeys.KeyCode, tblKeysRequests.RqstDate;
Should I remove the names section completely? I hadn't come up with a
solution to get this to automatically roll over for the next school year. I
was getting to that after I get this worked out. Thanks to both of you for
your questions. I'm still a novice learning as I go.
Duane said:
It isn't clear how you want this sorted. Do you care only about the month
number or the month and year? How does this related to the order of LastName
and KeyCode?
If you have RqstDate, you can get its sortable month with the
Month(Rqstdate) function. Typically I don't do any formatting like this in
the query. Formatting of values is a visual/presentation task that should be
handled in the controls on your form or report.
I'm having the same problem. I want to sort a report by month and am using
group by in the query which includes this as a calculated field:
[quoted text clipped - 46 lines]