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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Displaying query results in a tabular format

Status
Not open for further replies.

egstatus

Programmer
Apr 14, 2005
143
US
Hi Everyone,
I have a query that I would like to format in a tabular way. (I'm using MS Access 2010)

This is a snapshot of the table's data:

undefined_ylstbq.png


This is my access query:
SQL:
SELECT [Income Statement Account Rollup Angelo].[Account Type],
[Income Statement Account Rollup Angelo].ID,
IIf(MonthNo='1',TotalTrans,0) AS Jan,
IIf(MonthNo='2',TotalTrans,0) AS Feb,
IIf(MonthNo='3',TotalTrans,0) AS Mar,
IIf(MonthNo='4',TotalTrans,0) AS Apr,
IIf(MonthNo='5',TotalTrans,0) AS May,
IIf(MonthNo='6',TotalTrans,0) AS Jun,
IIf(MonthNo='7',TotalTrans,0) AS Jul,
IIf(MonthNo='8',TotalTrans,0) AS Aug,
IIf(MonthNo='9',TotalTrans,0) AS Sep,
IIf(MonthNo='10',TotalTrans,0) AS Oct,
IIf(MonthNo='11',TotalTrans,0) AS Nov,
IIf(MonthNo='12',TotalTrans,0) AS Dec
FROM [Income Statement Account Rollup Angelo];

This is what I'm getting:
undefined_plp4oh.png


Idealy I would like to see just one line for Account and ID with a value for each month.

What Am I doing wrong here?

Thanks
 
Create a crosstab query with [Account Type] and ID as Row Headings, MonthName([MonthNo]) as the Column Heading, and Sum(TotalTrans) as the value. Set the Column Headings property of the crosstab query to:
Column Headings:"Jan","Feb","Mar",...etc...,"Dec"

Duane
Hook'D on Access
MS Access MVP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top