Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating a Query that is kinda like a crosstab query

Status
Not open for further replies.

Crauck

Programmer
Jul 26, 2002
24
US
I am trying to create an Index Page from my data in Access. I have a table created with the Name and Page Number. But a name might be on more than one page, so I need a table that looks something like this.

1stpage 2ndpage 3rdpage 4thpage
Name

Any ideas on how to do this?? I thought some kind of Crosstab query but I don't need a value, I just need a Column and Row Heading.

Cristy
 
In my example query I've got a table called tblMyTableName with two fields called Name and PageNumber. Here's the query.
Code:
TRANSFORM Count(tblMyTableName.PageNumber) AS CountOfPageNumber
SELECT tblMyTableName.Name
FROM tblMyTableName
GROUP BY tblMyTableName.Name
PIVOT tblMyTableName.PageNumber;

Hope this gets you started.

[pc2]
 
That pretty much just tries to create a crosstab query which makes the Column Headers go up to the highest page number 1-?. The most pages anyone has is 4 pages so I need it to look like this:

Page1 Page2 Page3 Page4
Name
Smith, Jane 3 6 10 22
Smith, John 3 12

Right Now I just have a table that has Name & Page, so it looks like this:

Name Page
Smith, Jane 3
Smith, Jane 6
Smith, Jane 10
Smith, Jane 22
Smith, John 3
Smith, John 12

Cristy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top