473,396 Members | 2,052 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,396 software developers and data experts.

Is there a trick to not have a cross-tab query sort the column headings?

pw
Hi,

I have month names (coming from a field in a table) as the column
heading in an Access 97 crosstab query. It is being sorted
alphabetically. This will not do. The only way that I know to get
around it is to use month numbers instead, but I'd rather have the
names appear.

Any ideas?

Thanks,

-pw
please use "pw at williamsonenterprises dot com" for e-mail
thanks
----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
Nov 12 '05 #1
4 5290
DFS
pw,

Since you generally use the query as the datasource for a form or report,
reorder the columns in the bound fields of the form or report object.

If you use the form wizard and create a datasheet default form, it will look
just like the query results anyway, but you can move the columns around and
save the ordering.


"pw" <pw@removewilliamsonenterprises.com> wrote in message
news:tr********************************@4ax.com...
Hi,

I have month names (coming from a field in a table) as the column
heading in an Access 97 crosstab query. It is being sorted
alphabetically. This will not do. The only way that I know to get
around it is to use month numbers instead, but I'd rather have the
names appear.

Any ideas?

Thanks,

-pw
please use "pw at williamsonenterprises dot com" for e-mail
thanks
----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==---- http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups ---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption

=---
Nov 12 '05 #2
pw
>
1) Open your crosstab query in design mode.
2) Switch to SQL View
3) Find the PIVOT statement in the SQL statement.
4) After the field the PIVOT statement is working on, add in:

IN
("January","February","March","April","May","June ","July","August","September","October","November" ,"December")

(watch the word wrap!)

Change the order of the month names to get whatever order you
want/need. By manipulating the IN Clause of the PIVOT statement, you
also control the left-to-right order of the columns. This is a fairly
common "trick" to do (in code) to create reports that appear to always
have the last month as the first column, the month before that as the
2nd column... (aka "rolling columns")

Note: after making this change, and then switching back to "Design
mode", you won't see the in clause. Access doesn't show it, but it's
there, and it persists. (If memory serves, they do appear under the
"ColumnHeadings" property of the field you have selected for a column
heading.)

Hi Chuck!

It worked! Except putting in the month name blanks out the zeroes
that were in columns(months) that didn't have any records for that
month. I need the zeroes in any cell that doesn't have any data for
it. The user is going to copy and paste this pivot table into Excel
(I offered to try and do it automatically through Office Automation
but he doesn't mind just copy and pasting it).

Any ideas?

Thanks!

-paul



On Tue, 16 Dec 2003 15:32:38 -0700, pw
<pw@removewilliamsonenterprises.com> wrote:
I have month names (coming from a field in a table) as the column
heading in an Access 97 crosstab query. It is being sorted
alphabetically. This will not do. The only way that I know to get
around it is to use month numbers instead, but I'd rather have the
names appear.


----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
Nov 12 '05 #3
pw
>pw,

Since you generally use the query as the datasource for a form or report,
reorder the columns in the bound fields of the form or report object.

If you use the form wizard and create a datasheet default form, it will look
just like the query results anyway, but you can move the columns around and
save the ordering.


I haven't thought what I am going to do with this query yet :-) Well,
I guess I have. It needs to be somewhere where the user can copy and
paste it into Excel.

I'll mess around with a form and try reordering the columns. Chuck's
suggestion worked though, except adding the month names in code
blanked out any cells that had zeroes in them (unless the column had a
value > 1 somewhere). I think I need zeroes, not blanks.

Thanks!!

-pw


"pw" <pw@removewilliamsonenterprises.com> wrote in message
news:tr********************************@4ax.com.. .
Hi,

I have month names (coming from a field in a table) as the column
heading in an Access 97 crosstab query. It is being sorted
alphabetically. This will not do. The only way that I know to get
around it is to use month numbers instead, but I'd rather have the
names appear.

Any ideas?

Thanks,

-pw
please use "pw at williamsonenterprises dot com" for e-mail
thanks
----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet

News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000

Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption

=---


----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
Nov 12 '05 #4
pw
>On Wed, 17 Dec 2003 11:01:17 -0700, pw
<pw@removewilliamsonenterprises.com> wrote:
1) Open your crosstab query in design mode.
2) Switch to SQL View
3) Find the PIVOT statement in the SQL statement.
4) After the field the PIVOT statement is working on, add in:
IN
("January","February","March","April","May","Ju ne","July","August","September","October","Novembe r","December")
(watch the word wrap!)
Change the order of the month names to get whatever order you
want/need. By manipulating the IN Clause of the PIVOT statement, you
also control the left-to-right order of the columns. This is a fairly
common "trick" to do (in code) to create reports that appear to always
have the last month as the first column, the month before that as the
2nd column... (aka "rolling columns")
Note: after making this change, and then switching back to "Design
mode", you won't see the in clause. Access doesn't show it, but it's
there, and it persists. (If memory serves, they do appear under the
"ColumnHeadings" property of the field you have selected for a column
heading.)

Hi Chuck!
It worked! Except putting in the month name blanks out the zeroes
that were in columns(months) that didn't have any records for that
month. I need the zeroes in any cell that doesn't have any data for
it. The user is going to copy and paste this pivot table into Excel
(I offered to try and do it automatically through Office Automation
but he doesn't mind just copy and pasting it).


Unfortunately, there's really no way around that. Well, there are a
couple of ways, neither of which do I use unless I have to, and that's
pretty darn rare. Personally, I just do my own export to excel when I
have to do this, and use the NZ function as a part of that code to
translate the Nulls. (If you haven't seen my "ExportToExcel"
function, which I've posted here a couple of times, I suggest getting
it. You can put it behind any form and just let the user click on a
button to run the query and create a Excel spreadsheet. I can post it
again, if needed, but....)

The other (non-recommended methods) involve using a query (or a set of
queries) or a table that will ensure that you won't have any "missing"
information for the cross-tab.


Learning lots from you Chuck. I searched this group in Google and I
see a bunch of posts of "ExportToExcel" but I didn't see you name on
them. I want to make sure I get the original :-)

Thanks again,

-paul
----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
Nov 12 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

17
by: Eternally | last post by:
Hey folks, I'm writing a simple C++ application which runs continuously. I'm running the program from the command line in Cygwin from XP, and it's cross-compatible with Linux. While running...
34
by: Marian Aldenhövel | last post by:
Hi, I am in the process of embarking on building a large web application. I wanted to seize that opportunity to learn how to use CSS and get rid of my ad-hoc approach to HTML-coding (i.e.: add...
7
by: Daniel Jung | last post by:
Hi ======== Problem: ======== I want images in table rows connect vertically. All images are 32 px in height. =====
1
by: MatthewRoberts | last post by:
Howdy All, I am having difficulty with two-way communication across AppDomains in an attempt to dynamically script applications. Everything works as expected, except when using ByRef parameters....
1
by: Gene Ariani | last post by:
Hi; Does any one know of asp.net web menu with cross frames capability, so the menus can cross frames and not be contained in them? Any direction is appreciated it.
35
by: Alex Martelli | last post by:
Having fixed a memory leak (not the leak of a Python reference, some other stuff I wasn't properly freeing in certain cases) in a C-coded extension I maintain, I need a way to test that the leak is...
16
by: petermichaux | last post by:
Hi, Does anyone have a a cross-browser setOpacity function that does not use browser sniffing? I looked at the Yahoo! UI function and it detects IE by looking for window.ActiveXObject. I also...
2
by: mattgarvin | last post by:
Hello, I need a piece of javascript that will allow a form to be submitted when Enter is pressed for IE6 and 7, Firefox 2, and recent versions of Safari. It is for a login page that has two...
3
by: Randy Yates | last post by:
Hi Folks, I have a cross-development problem in which I'm using the x86_64 version of Fedora Core 6 as a development system but want to build executables that are 32-bit. I've got a mix of C...
7
by: atlaste | last post by:
Hi, I have two different things I'd like to discuss here. Both are about cross-process synchronization of shared resources. The resources that are shared are: (1) an object writing to a file and...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.