Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Formatting data in a crosstab query

Posted on 2014-03-14
5
Medium Priority
?
376 Views
Last Modified: 2014-03-20
I have created a select query where I calculate the % of pupils working at a certain level in each subject.

I now want to create a crosstab query with the level as a row heading and subject as a column heading and display the % of pupils but although it is formatted as % in the select query and displays correctly in does not display this way in the crosstab query

Level      Art      Drama
      0.809836065573771      0.809836065573771
2      0.101639344262295      9.50819672131148E-02
3      8.85245901639344E-02      9.50819672131148E-02

Even though I got to properties and select format > percentage it does not seem to work.

Tricia
0
Comment
Question by:tmckeating
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 48

Expert Comment

by:Dale Fye
ID: 39930573
Are you perhaps using the NZ( ) function anywhere in the query(s) that generate this?

When used in a query, the NZ( ) function will return a string, and when you try to format the string as %, in the query designer, it will not work.  If you use NZ( ), try wrapping it in a type conversion functions, something like cdbl(NZ([field name]))  and see if that works.
0
 

Author Comment

by:tmckeating
ID: 39931141
I am not using NZ anywhere in the query and adding cdbl does not appear to do anything.

Tricia
0
 
LVL 48

Accepted Solution

by:
Dale Fye earned 1000 total points
ID: 39931174
can you provide the SQL for the queries (multiple SQL Statements if nested) that generate these values.

What does the data look like before you do the crosstab?  Is it normalized like:

Level   Course    Pct
1          Art           0.809836065573771
1          Drama     0.809836065573771
2          Art           0.101639344262295
2          Drama    9.50819672131148E-02
3          Art           8.85245901639344E-02
3          Drama    9.50819672131148E-02

I normally prefer to use the query design grids formatting properties Query column formmatingbut on occasion will actually use the Format( ) function to force query output into a format that I'm not able to get with the query format parameter.  You might try using a format like:

format([Pct], "#0.0000%") in the query that creates the cross-tab
0
 

Author Closing Comment

by:tmckeating
ID: 39941931
I was using the formatting properties as you showed above but that did not work ...the format() function worked superbly. Thanks again for your help.
0
 
LVL 48

Expert Comment

by:Dale Fye
ID: 39942221
Glad I could help.

You just need to make sure your understand that the Format( ) function returns a string, not a number, whereas using the Format property of the query affects the way the data is displayed, but will retain it's actual value.
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

718 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question