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 » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

an ALIAS question?



 
 
Thread Tools Display Modes
  #1  
Old March 21st, 2010, 09:50 PM posted to microsoft.public.access.queries
cinnie
external usenet poster
 
Posts: 67
Default an ALIAS question?

hello gurus

I have a Report based on the Cross Tab query shown below:

TRANSFORM Count(qryEmp.SiteID) AS CountOfSiteID
SELECT qryEmp.SiteName, Count(qryEmp.SiteID) AS [Site Count]
FROM qryEmp
GROUP BY qryEmp.SiteName
PIVOT qryEmp.MtgCode;

Each record in the detail section of the report shows SiteName, [Site
Count], and up to 10 more fields, one for each of the values of MtgCode.
Typical values for MtgCode might be York1, York2, D1, Essex-05 ...

Here is my problem. Because these values change all the time, I want the
text boxex in the Report's detail section to refer to Control Sources of A,
B, C... instead York1, York2, D1.... . Also, space constraints dictate this
A,B,C... scheme.

This sounds like an ideal place to use ALIAS, but I can't figure out how to
assign ALIASes to the pivot fields. Hope this makes sense!

--
cinnie
  #2  
Old March 21st, 2010, 11:02 PM posted to microsoft.public.access.queries
Marshall Barton
external usenet poster
 
Posts: 5,361
Default an ALIAS question?

cinnie wrote:
I have a Report based on the Cross Tab query shown below:

TRANSFORM Count(qryEmp.SiteID) AS CountOfSiteID
SELECT qryEmp.SiteName, Count(qryEmp.SiteID) AS [Site Count]
FROM qryEmp
GROUP BY qryEmp.SiteName
PIVOT qryEmp.MtgCode;

Each record in the detail section of the report shows SiteName, [Site
Count], and up to 10 more fields, one for each of the values of MtgCode.
Typical values for MtgCode might be York1, York2, D1, Essex-05 ...

Here is my problem. Because these values change all the time, I want the
text boxex in the Report's detail section to refer to Control Sources of A,
B, C... instead York1, York2, D1.... . Also, space constraints dictate this
A,B,C... scheme.

This sounds like an ideal place to use ALIAS, but I can't figure out how to
assign ALIASes to the pivot fields.



You can't. A crosstab query calculates the field names from
the contents of the Pivot field in the selected records. If
you want to use something other than MtgCode, then you need
another field in the table that contains the aliases (A, B,
C...) that you want to see in the query. If you can't
change the table you have now, then create another table
with just fields for the MtgCode and its alias and join it
in your query.

--
Marsh
MVP [MS Access]
  #3  
Old March 22nd, 2010, 02:44 AM posted to microsoft.public.access.queries
Duane Hookom[_4_]
external usenet poster
 
Posts: 316
Default an ALIAS question?

Great idea to provide an alias for each column. This is the exact solution
used in the crosstab report demo at
http://www.rogersaccesslibrary.com/f...cz2 667z7b7b9.

--
Duane Hookom
MS Access MVP


"cinnie" wrote in message
...
hello gurus

I have a Report based on the Cross Tab query shown below:

TRANSFORM Count(qryEmp.SiteID) AS CountOfSiteID
SELECT qryEmp.SiteName, Count(qryEmp.SiteID) AS [Site Count]
FROM qryEmp
GROUP BY qryEmp.SiteName
PIVOT qryEmp.MtgCode;

Each record in the detail section of the report shows SiteName, [Site
Count], and up to 10 more fields, one for each of the values of MtgCode.
Typical values for MtgCode might be York1, York2, D1, Essex-05 ...

Here is my problem. Because these values change all the time, I want the
text boxex in the Report's detail section to refer to Control Sources of
A,
B, C... instead York1, York2, D1.... . Also, space constraints dictate
this
A,B,C... scheme.

This sounds like an ideal place to use ALIAS, but I can't figure out how
to
assign ALIASes to the pivot fields. Hope this makes sense!

--
cinnie


  #4  
Old March 22nd, 2010, 05:41 PM posted to microsoft.public.access.queries
cinnie
external usenet poster
 
Posts: 67
Default an ALIAS question?

thanks to Marshall and Duane for some solid advice - cinnie
--
cinnie


"Marshall Barton" wrote:

cinnie wrote:
I have a Report based on the Cross Tab query shown below:

TRANSFORM Count(qryEmp.SiteID) AS CountOfSiteID
SELECT qryEmp.SiteName, Count(qryEmp.SiteID) AS [Site Count]
FROM qryEmp
GROUP BY qryEmp.SiteName
PIVOT qryEmp.MtgCode;

Each record in the detail section of the report shows SiteName, [Site
Count], and up to 10 more fields, one for each of the values of MtgCode.
Typical values for MtgCode might be York1, York2, D1, Essex-05 ...

Here is my problem. Because these values change all the time, I want the
text boxex in the Report's detail section to refer to Control Sources of A,
B, C... instead York1, York2, D1.... . Also, space constraints dictate this
A,B,C... scheme.

This sounds like an ideal place to use ALIAS, but I can't figure out how to
assign ALIASes to the pivot fields.



You can't. A crosstab query calculates the field names from
the contents of the Pivot field in the selected records. If
you want to use something other than MtgCode, then you need
another field in the table that contains the aliases (A, B,
C...) that you want to see in the query. If you can't
change the table you have now, then create another table
with just fields for the MtgCode and its alias and join it
in your query.

--
Marsh
MVP [MS Access]
.

 




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


All times are GMT +1. The time now is 03:35 PM.


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