Solved

Display Records Horizontally in Access

Posted on 2010-11-15
7
544 Views
Last Modified: 2013-12-25
I want to display the records of an evaluation table horizontally instead of vertically.  Through an answer from this website (a really long time ago) I was able to create an SQL query that did just that.  Here is a sample:


EvalID      Q1      Question02      Question03      Question04
244                4              4                      4                      4
245                5              5                      4                      5
246                5              5                      5                      5
247                5              5                      5                      5


When I run the SQL, it appears like this:

Questions      244      245      246      247
Question01      4      5      5      5
Question02      4      5      5      5
Question03      4      4      5      5
Question04      4      5      5      5

The 244, 245 etc are the EvalID that will change every time the query is run.

Here is the code behind the SQL:
TRANSFORM MAX(COMB.TV) AS MTV
SELECT COMB.Questions
FROM (SELECT EvalID,Q1 as TV,'Q1' as Questions FROM qryEvalScores
UNION
SELECT EvalID,Question02 As TV,'Question02' as Questions FROM qryEvalScores
UNION
SELECT EvalID,Question03 AS TV,'Question03' as Questions FROM qryEvalScores
UNION
SELECT EvalID,Question04 As TV,'Question04' as Questions FROM qryEvalScores AS COMB
GROUP BY COMB.Questions
PIVOT COMB.EvalID;

It works great in the query.  The problem is, I would like to build a report but I can't because the EvalIDs will change each time rendering any textboxes in the report obsolete.

I think what I need to do is put the SQL into VB to recreate the report each time, I am just not sure how to do it.  

Any help would be appreciated.
0
Comment
Question by:Cindy6777
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
7 Comments
 
LVL 74

Accepted Solution

by:
Jeffrey Coachman earned 500 total points
ID: 34142401
This is the inherent problem with wanting to display data in this fashion...

Here is one solution, ...Happy Reading.
http://support.microsoft.com/kb/328320

;-)

JeffCoachman
0
 
LVL 74

Assisted Solution

by:Jeffrey Coachman
Jeffrey Coachman earned 500 total points
ID: 34142402
0
 
LVL 74

Assisted Solution

by:Jeffrey Coachman
Jeffrey Coachman earned 500 total points
ID: 34142466
Another Option:
(If possible) create a standard "Normalized" table for your data.
At least in this way you can create a simple crosstab query to get the same results.
Then print the Crosstab query directly...?

Simple sample attached, see the table and query
db315.mdb
0
The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

 
LVL 44

Expert Comment

by:GRayL
ID: 34191751
Can you show us the structure of query qryEvalScores
0
 
LVL 44

Expert Comment

by:GRayL
ID: 34191795
How about:

TRANSFORM MAX(COMB.TV) AS MTV
SELECT COMB.EvalID
FROM (SELECT EvalID,Q1 as TV,'Q1' as Questions FROM qryEvalScores
UNION
SELECT EvalID,Question02 As TV,'Question02' as Questions FROM qryEvalScores
UNION
SELECT EvalID,Question03 AS TV,'Question03' as Questions FROM qryEvalScores
UNION
SELECT EvalID,Question04 As TV,'Question04' as Questions FROM qryEvalScores AS COMB
GROUP BY COMB.EvalID
PIVOT COMB.Questions;
0
 
LVL 53

Expert Comment

by:Dhaest
ID: 34440900
This question has been classified as abandoned and is being closed as part of the Cleanup Program.  See my comment at the end of the question for more details.
0

Featured Post

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

724 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question