A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Setting Up & Running Reports
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Report on Crosstab Query



 
 
Thread Tools Display Modes
  #1  
Old February 7th, 2005, 03:59 PM
Glenn Suggs
external usenet poster
 
Posts: n/a
Default Report on Crosstab Query

Can anyone please help with this problem? I have a report based on a
crosstab query where columns are years going 9 years into the past including
the current one. i.e.. 1997, 1998, 1999, etc. The fields on the report that
are bound to the data appear to be "hard-coded" and need changing at the end
of every year. I have written code to load the labels, etc. with current
info, but is there a way to make the report's text boxes be bound to current
data as well?

Thanks in advance
--
Glenn
  #2  
Old February 7th, 2005, 06:42 PM
Marshall Barton
external usenet poster
 
Posts: n/a
Default

Glenn Suggs wrote:

Can anyone please help with this problem? I have a report based on a
crosstab query where columns are years going 9 years into the past including
the current one. i.e.. 1997, 1998, 1999, etc. The fields on the report that
are bound to the data appear to be "hard-coded" and need changing at the end
of every year. I have written code to load the labels, etc. with current
info, but is there a way to make the report's text boxes be bound to current
data as well?



Change the query's PIVOT clause to use:
"Y" & (Year(Date) - Year(datefield))

Then the report text boxes can be bound to the field names
M0, M1, ...

--
Marsh
MVP [MS Access]
  #3  
Old February 7th, 2005, 08:03 PM
Glenn Suggs
external usenet poster
 
Posts: n/a
Default

I tried this and all the columns that had years disappeared. They became one
column with Y0 at the top. Is this the correct syntax for the PIVOT clause?
PIVOT "Y" & (Year(Date)-Year([DATE])) where [DATE] is my date field...

"Marshall Barton" wrote:

Glenn Suggs wrote:

Can anyone please help with this problem? I have a report based on a
crosstab query where columns are years going 9 years into the past including
the current one. i.e.. 1997, 1998, 1999, etc. The fields on the report that
are bound to the data appear to be "hard-coded" and need changing at the end
of every year. I have written code to load the labels, etc. with current
info, but is there a way to make the report's text boxes be bound to current
data as well?



Change the query's PIVOT clause to use:
"Y" & (Year(Date) - Year(datefield))

Then the report text boxes can be bound to the field names
M0, M1, ...

--
Marsh
MVP [MS Access]

  #4  
Old February 7th, 2005, 09:42 PM
Marshall Barton
external usenet poster
 
Posts: n/a
Default

You don't really have a field named DATE, do you? Since
that is the name of the Date function, you may be running
into a name conflict here.

OTOH, I left out the parenthesis, it should be:
PIVOT "Y" & (Year(Date())-Year([DATE]))
--
Marsh
MVP [MS Access]



Glenn Suggs wrote:
I tried this and all the columns that had years disappeared. They became one
column with Y0 at the top. Is this the correct syntax for the PIVOT clause?
PIVOT "Y" & (Year(Date)-Year([DATE])) where [DATE] is my date field...


Glenn Suggs wrote:
Can anyone please help with this problem? I have a report based on a
crosstab query where columns are years going 9 years into the past including
the current one. i.e.. 1997, 1998, 1999, etc. The fields on the report that
are bound to the data appear to be "hard-coded" and need changing at the end
of every year. I have written code to load the labels, etc. with current
info, but is there a way to make the report's text boxes be bound to current
data as well?



"Marshall Barton" wrote:
Change the query's PIVOT clause to use:
"Y" & (Year(Date) - Year(datefield))

Then the report text boxes can be bound to the field names
M0, M1, ...


  #5  
Old February 7th, 2005, 09:46 PM
Duane Hookom
external usenet poster
 
Posts: n/a
Default

I believe Marsh meant (note the additional ()s):
PIVOT "Y" & (Year(Date())-Year([DATE]))

--
Duane Hookom
MS Access MVP
--

"Glenn Suggs" wrote in message
...
I tried this and all the columns that had years disappeared. They became
one
column with Y0 at the top. Is this the correct syntax for the PIVOT
clause?
PIVOT "Y" & (Year(Date)-Year([DATE])) where [DATE] is my date
field...

"Marshall Barton" wrote:

Glenn Suggs wrote:

Can anyone please help with this problem? I have a report based on a
crosstab query where columns are years going 9 years into the past
including
the current one. i.e.. 1997, 1998, 1999, etc. The fields on the report
that
are bound to the data appear to be "hard-coded" and need changing at the
end
of every year. I have written code to load the labels, etc. with
current
info, but is there a way to make the report's text boxes be bound to
current
data as well?



Change the query's PIVOT clause to use:
"Y" & (Year(Date) - Year(datefield))

Then the report text boxes can be bound to the field names
M0, M1, ...

--
Marsh
MVP [MS Access]



  #6  
Old February 8th, 2005, 12:41 PM
Glenn Suggs
external usenet poster
 
Posts: n/a
Default

Many thanks. This has helped to resolve my problem. I'm now getting all the
correct values in the correct rows and columns again with Y0...Y8 as column
headings. I can take it from there.

Thanks again,
Glenn

"Marshall Barton" wrote:

You don't really have a field named DATE, do you? Since
that is the name of the Date function, you may be running
into a name conflict here.

OTOH, I left out the parenthesis, it should be:
PIVOT "Y" & (Year(Date())-Year([DATE]))
--
Marsh
MVP [MS Access]



Glenn Suggs wrote:
I tried this and all the columns that had years disappeared. They became one
column with Y0 at the top. Is this the correct syntax for the PIVOT clause?
PIVOT "Y" & (Year(Date)-Year([DATE])) where [DATE] is my date field...


Glenn Suggs wrote:
Can anyone please help with this problem? I have a report based on a
crosstab query where columns are years going 9 years into the past including
the current one. i.e.. 1997, 1998, 1999, etc. The fields on the report that
are bound to the data appear to be "hard-coded" and need changing at the end
of every year. I have written code to load the labels, etc. with current
info, but is there a way to make the report's text boxes be bound to current
data as well?


"Marshall Barton" wrote:
Change the query's PIVOT clause to use:
"Y" & (Year(Date) - Year(datefield))

Then the report text boxes can be bound to the field names
M0, M1, ...



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Union Query Not Returning A Value Jeff G Running & Setting Up Queries 2 October 19th, 2004 05:47 PM
Dynamic crosstab query report Richardson Setting Up & Running Reports 1 August 31st, 2004 10:13 PM
Print Taher Setting Up & Running Reports 1 August 31st, 2004 09:07 PM
Display Parameter from Form on Report sara Setting Up & Running Reports 10 July 19th, 2004 04:54 PM
Report Populated by a crosstab query Michael Noblet Setting Up & Running Reports 3 June 1st, 2004 07:11 PM


All times are GMT +1. The time now is 12:46 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.