By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,847 Members | 2,292 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,847 IT Pros & Developers. It's quick & easy.

format of column heading in crosstab query

P: n/a
Hi,
I want to create a crosstab query that looks like this

Date | Elevation 1 | Elevation 2 | ...
__________________________________________________ ____________________
Date 1 | xx.y | xx.y
Date 2 | xx.y | xx.y

xx.y are measurements taken at different dates at different elevations.
xx.y and elevation happen to be in the same format (meters).

The problem is, that the elevations in the column heading are numbers.
In the heading of the crosstab query in datasheet view they are all not
defined as numbers. They look like "286_983". That is the decimal point
is replaced by an underscore.

I needed them to be in number format, so I can plot the crosstab
Is there a way to change the number format? I tried cdec, but it
wouldn't work.

I don't want to change Elevation with Date (rowheading with
columnheading), because I want to make a chart from it later (and I
didn't find a way to make a chart with the rowheading as datasource for
the y-axis)

The SQL looks like this (WTelev are the xx.y in the sample above)

TRANSFORM Avg(WTelev) AS AvgOfWTelev
SELECT [date of sampling]
FROM qry_WTprof INNER JOIN {...}
GROUP BY [date of sampling]
ORDER BY [date of sampling]
PIVOT ElevationMP;

I'd appreciate any help!
Thanks,
Claus
Nov 13 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Claus Haslauer wrote:
Hi,
I want to create a crosstab query that looks like this

Date | Elevation 1 | Elevation 2 | ...
__________________________________________________ ____________________
Date 1 | xx.y | xx.y
Date 2 | xx.y | xx.y

xx.y are measurements taken at different dates at different elevations.
xx.y and elevation happen to be in the same format (meters).

The problem is, that the elevations in the column heading are numbers.
In the heading of the crosstab query in datasheet view they are all not
defined as numbers. They look like "286_983". That is the decimal point
is replaced by an underscore.

I needed them to be in number format, so I can plot the crosstab
Is there a way to change the number format? I tried cdec, but it
wouldn't work.

I don't want to change Elevation with Date (rowheading with
columnheading), because I want to make a chart from it later (and I
didn't find a way to make a chart with the rowheading as datasource for
the y-axis)

The SQL looks like this (WTelev are the xx.y in the sample above)

TRANSFORM Avg(WTelev) AS AvgOfWTelev
SELECT [date of sampling]
FROM qry_WTprof INNER JOIN {...}
GROUP BY [date of sampling]
ORDER BY [date of sampling]
PIVOT ElevationMP;


Change

PIVOT ElevationMP

to

PIVOT "Elevation " & Format(ElevationMP, "000.000")

This assumes the data type of the column "ElevationMP" is a numeric data
type.

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
Nov 13 '05 #2

P: n/a
MGFoster wrote:
Claus Haslauer wrote:
Hi,
I want to create a crosstab query that looks like this

Date | Elevation 1 | Elevation 2 | ...
__________________________________________________ ____________________
Date 1 | xx.y | xx.y
Date 2 | xx.y | xx.y

xx.y are measurements taken at different dates at different elevations.
xx.y and elevation happen to be in the same format (meters).

The problem is, that the elevations in the column heading are
numbers. In the heading of the crosstab query in datasheet view they
are all not defined as numbers. They look like "286_983". That is the
decimal point is replaced by an underscore.

I needed them to be in number format, so I can plot the crosstab
Is there a way to change the number format? I tried cdec, but it
wouldn't work.

I don't want to change Elevation with Date (rowheading with
columnheading), because I want to make a chart from it later (and I
didn't find a way to make a chart with the rowheading as datasource
for the y-axis)

The SQL looks like this (WTelev are the xx.y in the sample above)

TRANSFORM Avg(WTelev) AS AvgOfWTelev
SELECT [date of sampling]
FROM qry_WTprof INNER JOIN {...}
GROUP BY [date of sampling]
ORDER BY [date of sampling]
PIVOT ElevationMP;

Change

PIVOT ElevationMP

to

PIVOT "Elevation " & Format(ElevationMP, "000.000")

This assumes the data type of the column "ElevationMP" is a numeric data
type.

Hm, the number of zeros after the decimal point determines how many
decimal points show up in the crosstab query. Unfortunately, it doesn't
change the decimal separator in the crosstab query from an underscore to
a decimal point.

Hm, if I change rowheading and columnheading, I get a chart by
inseerting a ms graph chart into an access form that is what I want,
except that it is 90 degrees rotated (i.e. I'd like the x-axis to be the
y-axis and vice versa).
I searched on goole about this, but all results said, the y-axis is the
one that shows the range of the values. Is that true?

Thanks,
Claus
Nov 13 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.