Combine Crosstab queries in Access

I have two Access database tables. One has monthly data and the other has annual data.
MONTHLY:
ID#      DATE                  VALUE
1      1/31/2015            100              
1      2/28/2015            200
1      3/31/2015            300
2      1/31/2015            100
2      2/28/2015            200
2      3/31/2015            300
3      1/31/2015            100
3      2/28/2015            200
3      3/31/2015            300
YEARLY:
ID#      DATE                  VALUE
1      12/31/2016            1000              
1      12/31/2017            1200
1      12/31/2018            1400
2      12/31/2016            1000
2      12/31/2017            1200
2      12/31/2018            1400
3      12/31/2016            1000
3      12/31/2017            1200
3      12/31/2018            1400
I created a crosstab for each table so the dates are in columns:
ID#      DATE            DATE            DATE            DATE
1      VALUE            VALUE            VALUE            VALUE
I need to combine the two tables so the first columns are monthly, and then the last columns are annual:
ID#      1/31/2015      2/28/2015      3/31/2015      12/31/2016      12/31/2017      12/31/2018
1      100            200            300            1000            1200            1400      
The combined crosstab I tried to create      won’t work because the dates in the crosstab columns are different between the two tables.
How can I combine the tables to provide one output?
ktjamms2Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jeffrey CoachmanMIS LiasonCommented:
I am sure this output is possible, ...but then it would not be a true "crosstab" query
...as I am not sure what you are seeking to see with two data-sets at two different intervals...

One issue here is how you are storing your data.
I have two Access database tables. One has monthly data and the other has annual data.
"Monthly" and "Annual" data are typically "summary" data, ...and as such should be calculated in a query and not stored in a tables (or tables)
You should only have one table with all the data. (Daily)

In any event, ...you can try something like this:
Database64.mdb
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
PatHartmanCommented:
As long as you have a common column in the two crosstabs, you can join them to produce the result you are after.
0
ktjamms2Author Commented:
Thanks!
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Jeffrey CoachmanMIS LiasonCommented:
I Think this may be more of what you are after:

Create a union query of the two tables:
SELECT * FROM tblMonthly
UNION SELECT * FROM tblYearly;
...This will give you an output like his:
Union
Then create a crosstab query from the Union:
TRANSFORM First(Query1.TheValue) AS FirstOfTheValue
SELECT Query1.ID
FROM Query1
GROUP BY Query1.ID
PIVOT Format([TheDATE],"Short Date") In ("1/31/2015","2/28/2015","3/31/2015","12/31/2016","12/31/2017","12/31/2018");
...This will give you this:
Crosstab
0
Jeffrey CoachmanMIS LiasonCommented:
sample
0
Jeffrey CoachmanMIS LiasonCommented:
here you go...
Database65.mdb
0
ktjamms2Author Commented:
Pat, I didn't see your post until after I accepted Jeffrey's solution. Can I open a new question to see what you have for a solution?
0
PatHartmanCommented:
If Jeffrey's solution worked for you, there is no need.  I didn't download his solution so I don't know what it was.  If it looks like what he posted subsequently, it will be fine.  It unions the data first and then makes a crosstab.
0
Jeffrey CoachmanMIS LiasonCommented:
ktjamms2,

I revised my post above (to more reflect your actual data) and presented a new sample.
Let me know what you think.

...and BTW, if you feel that Pat's post is useful as well, ...you can request that the Q be re-opened, and you can accept whatever posts you feel helped you out.
;-)

Jeff
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.