Skip to content
Advertisement

MS Access Query to get multiple counts from the same field

I’m querying imported data that has a date/time field that I can’t format as date in the table.

Sample:

I’m trying to get a count of how many tickets each user has per month. Because the Date field comes from the database as a text field, I can’t seem to make that format as date/time so I use “left” to filter by month. This is what I’ve used to get a return on a single User item for the month of October.

I would like to add counts for User2 through UserX per month so that I can get a count row or column for each the quantity of tickets for each user each month in one report. Everything I’ve tried won’t save the query due to syntax errors in one form or another. I’ve tried variations of the following query help post as well without success.

FROM myTable a ;

I’m sure the answer is staring at me, just not sure what at the moment.

Thanks for reading

John

Advertisement

Answer

This is only an answer to your first question about how to deal with dates that are stored in text fields.

To get the count for all users for every month you can do:

A text field containing a date that is always in the same format can be treated as a date with Format() so Format([Date],’mmmm’) returns the full month name for each date.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement