Query by month?

  • Thread starter Thread starter Todd
  • Start date Start date
T

Todd

I have a database with multiple users.
I've created a table that captures the Log on time and
username for each time that a user logs into the database.

Table: UsageLog
Fields: UsageID (autonum), LogOnDate (date/time), UserName

I'd like to create a query/report that will count the
number of times that a person logs on each month, and also
totals for the year. Is there an easy way to do this?
 
You can create a Totals query

SELECT UsageLog.UserName, Year([LogOnDate]) AS TheYear, Month([LogOnDate])
AS TheMonth, Count(UsageLog.UsageID) AS CountOfUsageID
FROM UsageLog
GROUP BY UsageLog.UserName, Year([LogOnDate]), Month([LogOnDate])
ORDER BY Year([LogOnDate]), Month([LogOnDate]);

Base your report on this query, and you can create grouping levels for
TheYear and for each user to then summarize by year.
 
Thanks. That's perfect!!!

-----Original Message-----
You can create a Totals query

SELECT UsageLog.UserName, Year([LogOnDate]) AS TheYear, Month([LogOnDate])
AS TheMonth, Count(UsageLog.UsageID) AS CountOfUsageID
FROM UsageLog
GROUP BY UsageLog.UserName, Year([LogOnDate]), Month ([LogOnDate])
ORDER BY Year([LogOnDate]), Month([LogOnDate]);

Base your report on this query, and you can create grouping levels for
TheYear and for each user to then summarize by year.

--
Joan Wild
Microsoft Access MVP

I have a database with multiple users.
I've created a table that captures the Log on time and
username for each time that a user logs into the database.

Table: UsageLog
Fields: UsageID (autonum), LogOnDate (date/time), UserName

I'd like to create a query/report that will count the
number of times that a person logs on each month, and also
totals for the year. Is there an easy way to do this?


.
 
Back
Top