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

cross tab query - column headings sorting

Status
Not open for further replies.

kobooky

Technical User
May 29, 2005
20
IL
I use a crosstab query.
The column headings is a field with user filled data that can be any string he wishes (there is no rule or limitation for this field and there shouldn't be)
Therefor I cannot tell what will be the actual names of the columns when the query is run.
The user has to fill in for each name a number for sorting.
I want the crosstab query to sort the columns according to this number and not according to the name.
How can this be done?
please help.
 
concatenate the number to the front of the name
Code:
TRANSFORM ...
SELECT ...
FROM ...
GROUP BY ...
PIVOT CStr(num) & '-' & name
yes, the column headings will be n-aaaaa format, but that's better than nothing, eh?

r937.com | rudy.ca
 
Thanks.
This will surely sort the column correctly but...
I use the column headings in a chart in a report and these names form the legend for the chart.
So in this way the legend come out wrong.
I'm looking for something else:
mayby a smart expression in the grid of the query or a subquery to define the order.
But I don't know how.
I was doing some reading in the forum and I found that others had the same probleme but they didn't get any answer that made it work.
I'm beginning to think that there is no way to do this.
Do you know how to address the "column headings" property of a query through VBA?
 
I had an idea:
use concatenation and between the tow parts - inserting chr(8) (backspace).
I tried it and it didnt work.
no real backspace was done.

Can someone tell me why?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top