Help with a query

SDowse

Board Regular
Joined
Sep 23, 2009
Messages
120
Hi,

I am new to Access and trying to learn as I go along...so forgive me if the below is basic.

I have a table that tracks visits to a website on a daily basis. The information is (currently) added in manually but I am looking to create a query that has a header for each month with a sum of visits against each header...i.e. a Jan column with a sum of the visits in Jan, a Feb column with a sum of the visits in Feb etc...

I currently have a query per month and a consolidating query - but I am hoping this can all be achieved through a single query?

Thanks in advance,
Me
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
This task can be accomplished without too much trouble, if your data is structured properly.
Basically, in your data source (table), you do NOT want separate columns for each month (otherwise you are having to add new columns every month, and a well designed table should seldom have to be altered!).

Basically, your data should be structured something like this:
Code:
ID      Month     Value
1        Jan         10
1        Feb          8
1        Mar          6
2        Jan         14
2        Feb         16
2        Mar          7
3        Jan          5
...
So each month, you are simply adding new records to your table (and not having to create any new columns)

Then, to get the results for any particular month, you simply query on the Month field.
You could even make your query a Parameter query, which allows you to enter the criteria at run-time when you try to open it.

If you want to see multiple months at one time across multiple columns, you would then just need to create a Crosstab query off of your table.

See this link for more info on Parameter and Crosstab queries: https://support.office.com/en-gb/ar...-a-query-c2806d3d-d500-45a8-8507-ec6af351b6ed
 
Upvote 0

Forum statistics

Threads
1,223,907
Messages
6,175,300
Members
452,633
Latest member
DougMo

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top