473,395 Members | 1,516 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,395 software developers and data experts.

Access Reports - Align Results Horizontally

3
new user and this seems like it would be easy to create, and i'm way over thinking. in short i have a table with a NAME field, and then a field for each position they may play. PITCHER, CATCHER, SS, ETC.

i want to create a report where each of my fields are labeled at top. Then if they play that position it will plug their name in the position colume. i ran a query which pulls the information, then when i put it in a report, the results for each colume do not start on line one of detail, it leaves big gaps. this is what i'm getting.

Expand|Select|Wrap|Line Numbers
  1. PITCHER        CATCHER          SS
  2. Smith
  3. Jones                           Jones
  4. Wills
  5. Cline                           Cline                  
  6. King            King
  7. Glass           Glass
I am looking to push all names to top, and not leave gaps by colume. should look like this:

Expand|Select|Wrap|Line Numbers
  1. PITCHER         CATCHER          SS
  2. Smith           King             Jones
  3. Jone            Glass            Cline
  4. Wills
  5. Cline
  6. King
  7. Glass
thanks for help!
Dec 8 '12 #1
22 4260
zmbd
5,501 Expert Mod 4TB
I'm sorry, do you mean this is the result?
PITCHER CATCHER SS
Smith King Jones
Jone Glass Cline
Or do you really want the names repeated as shown?
Dec 8 '12 #2
zmbd
5,501 Expert Mod 4TB
Opps, I also meant to ask for your SQL.
Please remember to format it using the <CODE/> button.

By giving us your SQL for the underlying query, we can use the same field names and also check to make sure that there isn't something fundamentally wrong.
Dec 8 '12 #3
lisamp
3
@zmbd
the spacing is off with what I posted on my question, but the second one is the "idea" of the result im looking for (of course using all the records in my table). The first table is the result I am getting.

the names are repeated because they may play both positions, PITCHER and CATCHER, therefor the last name was filled in that colume based on the query i set up in office 2007, Access. Again the query is working, however when i put it in a report, as you can see, the columes don't all line up horizontally in the detail section. I want each colume to populate on line 1, not leave gaps.
I simply want it to have 3 columes labeled PITCHER, CATCHER, SS and then have the players name listed under the colume (or position) in which they play. they may play two or three positions, so there name would populate under each colume. does that make sense.

PITCHER CATCHER
Dec 8 '12 #4
Rabbit
12,516 Expert Mod 8TB
Use code tags when you need to preserve white space.

You'll need 3 queries, one for each position, in each query, you will need to number the rows, and then join the queries together with an outer join.

Alternatively, you could use 3 subreports.
Dec 9 '12 #5
NeoPa
32,556 Expert Mod 16PB
This is an extraordinarily difficult question as you seem to be asking for what is essentially three separate queries to appear synchronised without any logical point of synchronisation (other than position within the list which is anathema to RDBMS theory).

Nothing immediately springs to mind (in Access - Excel could handle it easily but then there are no such database constraints on Excel data). I'll keep my mind's eyes peeled for any ideas though. If anything occurs to me I'll be back. Obviously I'm excluding a code-based solution as being fundamentally too much of a kludge, but maybe we'll have to fall back on that if nothing logical occurs to anyone.
Dec 9 '12 #6
NeoPa
32,556 Expert Mod 16PB
Rabbit:
You'll need 3 queries, one for each position, in each query, you will need to number the rows, and then join the queries together with an outer join.
  1. How would you suggest numbering the records from the three queries?
  2. How would an OUTER JOIN (For Access I assume you're referring to an unspecified linking, or Cartesian Product, of the three tables but filtering with a WHERE clause) manage to produce the results required? I assume you envision the linking factor to be the ordinal position value of each query record.

PS. Sorry, the answer to #2 is a little obvious (blush). I wasn't seeing it when I posted.
Dec 9 '12 #7
zmbd
5,501 Expert Mod 4TB
OK, Now that I see the formatting (thnx Rabbit, he's my Hero :) )

From Rabbit, Neopa, and the reformat: What I understand you to want this to be as in a flat file - excel worksheet type arrangement.

Silly question I know; however, do I understand what you want correctly?
Dec 9 '12 #8
NeoPa
32,556 Expert Mod 16PB
Z:
do I understand what you want correctly?
The request was for a report if that helps Z. Does that answer your question or do I misunderstand it?
Dec 9 '12 #9
zmbd
5,501 Expert Mod 4TB
No, I understand it is for a report.

I have something similar at work that might work; however, before I go to the trouble of attempting the VPN connection I wanted to make sure I understood the OP correctly.

The VPN is very hostile to my router firewall for some reason. I've even let the Corporate I.T. gurus take a look (like Really wanted to let them have free reign on the personal pc) and they couldn't figure it out. Also because it is on the VPN I can't transfer the files between the VPN and Local directly. Instead I have to do some juggling with the encrypted drives. Real Pain.

IF I had my notes, then I'd just post that information.

Basically, it's a cross-tab query report; however, as I've mentioned in the past, cross-tabs are not my strong point; thus, I'd have a lot more confidence in offering the solution if I either had my notes or my work handy. :)
Dec 9 '12 #10
NeoPa
32,556 Expert Mod 16PB
That's fine. I thought it might have been a simple misunderstanding, in which case I might have saved you the time of having to wait for the sun to come up in whatever part of the world Lisa is posting from. It's seems you'll have to wait for her however, I'm afraid.

Nor can I help with your Central IT and VPN issues :-( I was in IT for many years, but we preferred the moniker Group IT for the acronym. Of course, my main role was in third-line support, or Tertiary IT. Far more interesting ;-)
Dec 9 '12 #11
lisamp
3
Thanks. What i'm taking out of this, is that can't be done as easy as i thought. And maybe i was on right track. I did run seperate querys for each position and filtered the blanks. Then i created a reeport for each, and then i created a final report with all the other positions as sub-reports. I really thought there should be an easier way. But that's the way i'm going to go for now. Again i'm new and much of what was discussed is over my head. Thanks everyone
Dec 9 '12 #12
Seth Schrock
2,965 Expert 2GB
I feel funny mentioning this since several experts haven't, but wouldn't it be easier if the database was normalized? In the OP, it says that the table has a field for each position. My understanding is that it would be better to have a many-to-many relationship between the players table and the position table. It would then be very simple to pull a report that grouped by position with the groups vertically arranged. If you really need it horizontally arranged, I don't know if it would help having it normalized for this particular problem. If I'm wrong, could someone explain where I've gone off?

More to the point of the question, couldn't you use a separate query for each position and then put a subform on the report for each position? Normally I wouldn't do this, but I don't think that the number of positions in baseball will change anytime soon so we should be safe doing this.
Dec 9 '12 #13
zmbd
5,501 Expert Mod 4TB
Seth,
You are right as far as the normalization.

As OP was talking about a report, I took this to mean that there was table on the report...

As for the suggested solution, Post 5 and post 12 both mention.

-
I braved my VPN last night... what I have is a form in pivot table view... it's actually quite ugly in that it has a total columns and the other "features" However, I played with it here at the house and I can get the thing to list as OP wants... it's just... really... well, ugly. And indeed this database has a table with employee info, and table with position (actually labs), and then a linking table (it's a roster for who is in what lab at the current movement as we rotate people thru positions/locations - useful when transferring workloads - I mean, telephone calls, yea, that's it, telephone calls! ;-)).
Dec 9 '12 #14
Seth Schrock
2,965 Expert 2GB
I did miss the references to the subforms in posts 5 & 12. As far as the table goes, I didn't think that there would be those blanks if the table referred to was just a table on a report. I guess I assumed that the table mentioned was a TableDef.
Dec 9 '12 #15
Rabbit
12,516 Expert Mod 8TB
@NeoPa, to number the rows, the OP would have to use one of those ranking queries. But sometimes they're more trouble than they're worth. It's probably easier to just use 3 different subreports.
Dec 9 '12 #16
NeoPa
32,556 Expert Mod 16PB
As you say Rabbit, the subreport approach is probably the preferred one, but would I be right in thinking a ranking query would depend on a sorting order being defined/specified. It couldn't work with the random order of the records, or positionally?
Dec 10 '12 #17
zmbd
5,501 Expert Mod 4TB
I Knew I had done this before!!!


YEA: I found version two of my database... it's not one that I use everyday... it one that I setup for my labs. My PC crashed and when they restored the drive I think they used an old backup image and I've been fighting this thing for about a month now to get all of my newest development db's back on the drive. Anyway... I had need to go back into the VPN to look at stuff.. long story... and decided I look at that DB on their PC.

And in that DB is the old url reference.... and I just found the new one.





Examples of reports that start each group in a new row or column

TRICK:
You can NOT use the wizard to setup the report otherwise the columns start getting messed up.
Start with a blank report in design mode, then add the fields as listed.

Nothing fancy... no unions... no subreports... no vba... no pivot tables. Just the single select query that relates the names to the normalized table.
(edit: there are joins between the player and postion tables to the roster table and the query does use those relationships to pull the names instead of the primary keys)
Attached Images
File Type: jpg bytesthread_945069.jpg (21.2 KB, 1298 views)
Dec 10 '12 #18
NeoPa
32,556 Expert Mod 16PB
That looks like it might be interesting Z. Why is there no explanation (No SQL). The link seems to give some report settings, but nothing about the data it's working from. Am I missing something obvious here?
Dec 10 '12 #19
zmbd
5,501 Expert Mod 4TB
Exactly.


There's nothing special about the SQL nor the tables from a normalized view point anyway:

qry_roster
Expand|Select|Wrap|Line Numbers
  1. SELECT 
  2.    tbl_positions.position_name,
  3.    tbl_players.player_name
  4. FROM tbl_positions 
  5.    INNER JOIN 
  6.     (tbl_players 
  7.        INNER JOIN tbl_roster 
  8.          ON tbl_players.player_pk = 
  9.             tbl_roster.roster_fk_players) 
  10.     ON tbl_positions.position_pk = 
  11.       tbl_roster.roster_fk_positions;
Tbl_positions
[position_PK] autonumber
[position_name] text(25)

Tbl_players
[player_PK] autonumber
[player_name] text(25)

Tbl_roster
[roster_PK] autonumber
[roster_fk_positions] long 1:M tbl_positions
[roster_fk_players] long 1:M tbl_players

Report1
bound to qry_roster
Group on positions
Labels removed
[tbl_positions.position_name] in the positions header
[tbl_players.player_name] in the details section

settings as indicated in the link.
The design of this report is similar to the one in the previous example, but the NewRowOrCol property of the CategoryID header is set to Before Section, and Column Layout is set to Down, Then Across in the Page Setup dialog box.
Dec 10 '12 #20
Rabbit
12,516 Expert Mod 8TB
@NeoPa, yes, you would need to specify something to sort by, you could use a PK or a randomly generated number. I don't think the order matters to the OP.
Dec 10 '12 #21
zmbd
5,501 Expert Mod 4TB
opps, I did specify to sort on the player names in the report otherwise nothing special.
((Correction... in the posted screen shot I had not added any sorting; however, after haveing made the post I thought sort by name would be nice and added it to the grouping to sort on tbl_players.player_name))


{edit - Screen shot of all data tables and the query}

Attached Images
File Type: jpg bytesthread_945069_data.jpg (43.1 KB, 1296 views)
Dec 10 '12 #22
NeoPa
32,556 Expert Mod 16PB
@Rabbit.
Cool. That makes sense.
@Z.
Ah. So the query results are grouped by the Position and essentially a break (In this case, because columns are used, the break goes to a new column rather than a new page.) occurs between each Position. I think I get it now.

May I say I like that solution. Far from an obvious one, so pretty clever, and elegant too :-)
@Lisa.
In my first post (#6) I suggested we may need to fall back on a code-based solution if no-one managed to come up with a more logical one. Well, it seems they have. One of the benefits of throwing something out there into the mix.
Dec 10 '12 #23

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

Similar topics

1
by: Joris Kempen | last post by:
Hi people, I know that the question has come around sometimes: How to open an Access Report using ASP and export it to for example RTF. I'm trying to implement the first method of David...
16
by: cyranoVR | last post by:
This is the approach I used to automate printing of Microsoft Access reports to PDF format i.e. unattended and without annoying "Save As..." dialogs, and - more importantly - without having to use...
5
by: Steven Taylor | last post by:
Hope someone can help. I have an application whereby in order to create one document type I effectively print out 3 or 4 access reports in correct order. So the user goes to the printer,...
1
by: Brian Barnes | last post by:
I've been searching using google trying to find a way to display Access Reports via ASP.NET and only finding commericial products which appear to require that the report needs to be converted every...
1
by: David | last post by:
Does anyone know how to run MS Access reports from VB.net. I'd like to keep the existing reports in the database if I can. Thanks David
0
by: dkurtz | last post by:
D. Lesandrini published an article some time ago about exporting Access reports as XML, and then updating those XML reports dynamically in ..NET....
16
by: JoeW | last post by:
I'm utilizing a database that I created within MS Access within a program I've created in VB.NET. I am using the VB front end to navigate the information, but want to be able to print a report,...
3
by: booner | last post by:
Is there any way to show an existing access database (.mdb) report inside a vb.net application? Any/all pointers much appreciated. BBB
1
by: NeoDeGenero | last post by:
I have a little VBA/Access - Reports problem and I’m not sure on how to approach it: I am trying to send a Report generated by MS Access via email through the command SendObject. ...
0
by: Qtip23 | last post by:
Hello All, So I have a my database information placed on a SharePoint site now that there is an immediate need for a web-based application in my division. I am able to print Access Reports...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.