473,387 Members | 1,574 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Rolling YTD Column Headings in Crosstab Query Report

6
I'm new to access and vba. I created a crosstab query with
a. User = Rowheading, b. Date = Columnheading c. rate = value.

Monthly productivity numbers will be added overtime so the column headings need to be dynamic with the months for a rolling ytd metric.

That being said, the report can have a fixed amount of 12 column headings, I just need the labels and values on the report to be dynamic.

How do I do this?

I've seen vba associated with OpenReport events.
Mar 2 '17 #1
4 1802
jforbes
1,107 Expert 1GB
I think this would mostly depend on how your Crosstab is written and how your Report is written. If you used the Wizard to create the Crosstab and then use the Wizard to create the Report, you most likely have columns that are named by the Month, like "Jan", "Feb", "Mar"... If you have this, then you probably only need to put the Start and End Date on the Report.

So what do you currently have and what are you looking to change?
Mar 3 '17 #2
ndd25
6
Thanks jforbes,

I've attached pictures of my query and report designs to help. You're right, the column headings of my report are just the months listed in the data. Right now, I have data only for Jan 2017 and Feb 2017. With time, I will be adding data for each month. In Jan 2018, Jan 2017 will need to drop off and this will need to continue.

Is there anyway to do a separate query to pull the months I want and have that feed into the column headings specified in the properties sheet?
Attached Images
File Type: jpg query.jpg (21.2 KB, 192 views)
File Type: jpg report.jpg (39.3 KB, 163 views)
Mar 3 '17 #3
jforbes
1,107 Expert 1GB
Crosstabs are some tricky queries, so hopefully this wont get too hairy.

Just playing around with the Access' create Query Wizard allowed me to create a Crosstab that has a SQL like this:
Expand|Select|Wrap|Line Numbers
  1. TRANSFORM Count(StudentAttendance.ID) AS CountOfID
  2. SELECT StudentAttendance.StudentID, Count(StudentAttendance.ID) AS [Total Of ID]
  3. FROM StudentAttendance
  4. GROUP BY StudentAttendance.StudentID
  5. PIVOT Format([AttendanceDate],"mmm") In ("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")
it looks like this in the QBE:



The nice thing about this is that it has the Column Headers without the Year, meaning that it will have the same Name for the Column Headers no matter what year it is.



With something like this, the only thing left to do would be put the date range at the top, and limit the report to a year at a time or otherwise the Months would total across the years. i.e. January 2017 and January 2016 would both be totaled into one number. It would be pretty simple if the report was limited to only one year at a time, but that might not work for you.

I'm curious of what you think.
Attached Images
File Type: jpg TestCrosstab.jpg (26.9 KB, 416 views)
File Type: png TestCrosstab2.png (7.1 KB, 467 views)
Mar 3 '17 #4
ndd25
6
Hmm, I think I was hoping for something a little more dynamic (i might have to come up with some vba to do the trick for issues other than months) but for now it'll work just fine! I restricted my query for the previous 11 months and the current month. That way all the data appears from a month associated only with one year. And then I altered the column headings to month excluding the year as you suggested. This solution will work for me. Thank you so much for your help Jforbes.
Mar 3 '17 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: Donna Sabol | last post by:
First, I should start by saying I am creating a database to be used by some very impatient, non-computer literate people. It needs to be seameless in it's operation from their point of view. I...
1
by: Steve | last post by:
I have looked through the newsgroup for an answer to this but haven't been able to find anything resembling my situation. What I want to do is relatively simple, I think. I have a crosstab...
1
by: krish_4u_only | last post by:
Hi, I have designed a subreport - record source is on crosstab query. crosstab query is designed on union query. The sub report is working fine when it is opened individually. but if i place it on...
3
by: Paula | last post by:
I need to do a summary using a crosstab query. The data has a Date field (Not named "Date"). I can do the Row Heading and Value but am having trouble with the Column Heading. The summary Columns...
15
by: Richard Hollenbeck | last post by:
I tried to ask this question before on the 14th of January but I never got a reply. I'm still struggling with the problem. I'll try to rephrase the question: I have a crosstab query with rows...
0
by: news | last post by:
Is there an option for psql to use the entry in Comments for "pretty" column headings in a report? For example, instead of printing the column name of "last" in the heading, the option would print...
2
by: scott.k.fraley | last post by:
....and the SELECT thats trying to pull from said Query doesn't like it one bit! ;) I'm working on this project (in Access 2002) and there is a report who's RecordSource is the following...
2
by: Nenad Markovic | last post by:
Hi everybody, When executing a Crosstab Query I see only rows (defined in a row heading) that have values (defined in value field) in at least one column (defined as column headings). How can...
3
kcdoell
by: kcdoell | last post by:
Hello Everyone: I have a table called “tblStaticAllForecast”, below are the fields I am currently focusing on within the table: LOB GWP FWeek Any given LOB can have a GWP and FWEEK...
8
by: Paul H | last post by:
I want to base a form on a crosstab query. The query shows statistics for a user defined period. The column headings will look something like this: ClientID Month01 Month02 Month03 etc.. ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.