473,626 Members | 3,291 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Report that does not display format properly (Based on Crosstab query).....

kcdoell
230 New Member
Hello:

I have a report that is based on the following crosstab query:

Expand|Select|Wrap|Line Numbers
  1. SELECT tblProduct.ProductName, QryProd_Bud.GWP_BUD, Nz([Week 1],0) AS Week_1, Nz([Week 2],0) AS Week_2, Nz([Week 3],0) AS Week_3, Nz([Week 4],0) AS Week_4, Nz([Week 5],0) AS Week_5, QryProd_Prior.GWP_PRI
  2. FROM ((tblProduct LEFT JOIN ctqQueryP_G ON tblProduct.ProductID = ctqQueryP_G.ProductIDFK) LEFT JOIN QryProd_Bud ON tblProduct.ProductID = QryProd_Bud.ProductIDFK) LEFT JOIN QryProd_Prior ON tblProduct.ProductID = QryProd_Prior.ProductIDFK;
My problem is that when the report displays my [GWP_PRI] or [GWP_BUD] they are not displaying in the standard format. For example the number should be 1,255 but is displaying 1255.

I have checked the table where [GWP] resides ([GWP_PRI] & [GWP_BUD] are based on this field) and I have it set to Number, Long Integer, Standard.

I have also checked the properties within the report, [GWP_PRI] & [GWP_BUD],and the properties format is set to "Standard". None of my other reports (they are not crosstab queries) have this issue with this same field [GWP].

Do crosstab queries do something funky to the format properties or am I missing something here? Any ideas would be helpful.

Thanks,

Keith.
May 9 '08 #1
6 3156
nico5038
3,080 Recognized Expert Specialist
Hello:

I have a report that is based on the following crosstab query:

Expand|Select|Wrap|Line Numbers
  1. SELECT tblProduct.ProductName, QryProd_Bud.GWP_BUD, Nz([Week 1],0) AS Week_1, Nz([Week 2],0) AS Week_2, Nz([Week 3],0) AS Week_3, Nz([Week 4],0) AS Week_4, Nz([Week 5],0) AS Week_5, QryProd_Prior.GWP_PRI
  2. FROM ((tblProduct LEFT JOIN ctqQueryP_G ON tblProduct.ProductID = ctqQueryP_G.ProductIDFK) LEFT JOIN QryProd_Bud ON tblProduct.ProductID = QryProd_Bud.ProductIDFK) LEFT JOIN QryProd_Prior ON tblProduct.ProductID = QryProd_Prior.ProductIDFK;
My problem is that when the report displays my [GWP_PRI] or [GWP_BUD] they are not displaying in the standard format. For example the number should be 1,255 but is displaying 1255.

I have checked the table where [GWP] resides ([GWP_PRI] & [GWP_BUD] are based on this field) and I have it set to Number, Long Integer, Standard.

I have also checked the properties within the report, [GWP_PRI] & [GWP_BUD],and the properties format is set to "Standard". None of my other reports (they are not crosstab queries) have this issue with this same field [GWP].

Do crosstab queries do something funky to the format properties or am I missing something here? Any ideas would be helpful.

Thanks,

Keith.
Standard will follow the settings you've specified on your PC in the Setting/ControlPanel application "Regional and Language options".
When you want to set it in the query it's best to use a Format() function, thus the format is explicit visible, although the format of the graphical query editor wil work, I hate it because you don't see it when opening the query in design mode.

Nic;o)
May 9 '08 #2
kcdoell
230 New Member
Hello:

So, I would do this modification in the property settings of the contol on the report itself? Something like "#,##0.00"

Keith.
May 9 '08 #3
nico5038
3,080 Recognized Expert Specialist
Yep, for a report and form you can use the Format property, in a query a Format() statement.

Just give it a try :-)

Nic;o)
May 9 '08 #4
kcdoell
230 New Member
Yep, for a report and form you can use the Format property, in a query a Format() statement.

Just give it a try :-)

Nic;o)

Okay I tried to input it into the field on the report and it did not change the number format.

I never formatted within a query expresion before so I am hoping you can guide me through it. I did some research but could not find any examples. Below is one of my expressions in my query:

Expand|Select|Wrap|Line Numbers
  1. Week_1: Nz([Week 1],0)
"Week_1" is a vaule that feeds off of my [GWP]. Can you show me how you would modify the above statement to incorporate the format I am looking for?

That would be great.

Thanks,

Keith.
May 10 '08 #5
Stewart Ross
2,545 Recognized Expert Moderator Specialist
Hi Keith. Format is a very versatile function - but you have to be careful that what goes into it is of the correct type. When you use Nz, what is returned is a string value, not a number (if you look at the columns returned in your query you will see that the ones where you have used Nz are left-aligned instead of the normal numeric right-alignment, a sure sign of the change to a string). Trying to set a format for numbers will not work if the value to be formatted is actually a string.

To resolve this and let format do its job properly you need to convert the output of Nz to a number again. You can use CLng() if it is a whole number, CDbl() if it is a floating-point value, or CCur() if it is a currency value.

For the whole-number example where you need to show the comma for thousands you can use:

Week 1A: Format(CLng(Nz([Week 1], 0)), "#,###")

However, Format also returns a string value, not a numeric, so it may be better to leave the format function out of your base query (retaining the CLng(Nz()) parts) then use the custom format property of the report or form control involved to display the value in the correct format for users. The format property of a control uses formats similarly to the Format function, so to display a value with the comma separator you would just enter #,### as the format (not enclosed in double quotes).

Instead of using Nz for numbers I use simple custom functions to return non-null whole-number and floating-point values. That way I don't have to explicitly type convert the output of the function. These are shown below.
Expand|Select|Wrap|Line Numbers
  1. Public Function NonNullDbl(Val_In) As Double
  2.   If IsNull(Val_In) Then
  3.     NonNullDbl = 0
  4.   Else
  5.     NonNullDbl = Val_In
  6.   End If
  7. End Function
  8.  
  9. Public Function NonNullLong(Val_In) As Long
  10.   If IsNull(Val_In) Then
  11.     NonNullLong = 0
  12.   Else
  13.     NonNullLong = Val_In
  14.   End If
  15. End Function
-Stewart
May 10 '08 #6
kcdoell
230 New Member
Stewart:

First and foremost my apologies for not getting back to you sooner, I was MIA for awhile making sure I did not miscalculate Mother's Day here in the USA... Second, I always enjoy reading your thoughtful responses.

Now to this particular lesson. You are correct all my values in this particular query are left aligned and that is because I incorporated the Nz. Now it makes better sense to me what was happening with respect to it not recognizing the standard format (the query sees it as a string). My “end” query (The query in question) for this report actually is based on three others. In which I did not use the Nz function. In those other queries the values are right aligned. So, to conclude I applied the following code to my end query:

Expand|Select|Wrap|Line Numbers
  1.  Week_1: CLng(Nz([Week 1],0)) 
Afterwards I went to my report, opened it in design mode, went to the properties of [Week_1] and applied the Standard format. The result, my formating was there!

Very simple when you understand what is going on……

Thanks a million to both of you!

Best regards,

Keith.

P.S. I must admit that I am not very familiar with public functions though that seems to be something I may incorporate later as I gain more experience.
May 12 '08 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

8
7562
by: Donna Sabol | last post by:
First, I should start by saying I am creating a database to be used by some very impatient, non-computer literate people. It needs to be seameless in it's operation from their point of view. I want them to do as little as possible when they run their reports. I have a crosstab query that displays usage of items for each month. It looks pretty much like this: ITEM DESC UM 12/02 1/03 2/03 3/03 ...ETC. 1 Solution ...
1
17656
by: Nathan Bloomfield | last post by:
Does anyone know if there is any documentation which relates to Access2k + ? or can anyone help adjust the code? I am having trouble converting the DAO references. TITLE :INF: How to Create a Dynamic Crosstab Report PRODUCT :Microsoft Access PROD/VER:1.00 1.10 OPER/SYS:WINDOWS
3
3347
by: Edward | last post by:
ACCESS 2k I need to design a report based on a rota system for staff at various shops. The data is effectively stored in a single table, along the lines of: Initials (e.g. BH, FG, RM etc.) Day (e.g. Monday, Tuesday etc.) Shop (e.g. Shop1, Shop2 etc.) StartTime (e.g. 8, 13 etc.)
12
6637
by: jkearns | last post by:
Hello, I made a report from a crosstab query following the steps onlined in MSDN's Solutions.mdb example. I now have a dynamic crosstab report (great!), but with one minor problem. I cannot get access to show NULL and 0 values seperately. I've tried the following Format properties in my text box: 0.0;;0;"" --> Both NULL and 0 values display as 0 0.0;;"";"" --> Both NULL and 0 values show up blank
1
5156
by: Brad | last post by:
Thanks for taking the time to read my question. I have a table of data that has Date, Data and Category. I need to show, in a report, each Categories Data by Date. The Date has to be it's own column across the top and Category down the left side. As data is entered, the number of unique dates increases. As a result the
6
4955
by: JayDawg | last post by:
Excel has this cool little function where you can copy data, and then paste it transposed so that which runs across the rows now runs down a colum and visa versa. Is there a way in access to create a report that would transpose the data from what is logical. I have a query that has a field for the date (by month) and then additional fields (15 of them) by which I enter in data. So in the Table/Query it is formated such that when the...
2
1873
AccessIdiot
by: AccessIdiot | last post by:
Hello all, I have a report that is based on a crosstab query. One of the fields in the crosstab query is based on a query. It is a coded value. When I look at the crosstab query it displays the value. But when I look at the report I get the coded value. For example, in the table it is; 1 apple 2 orange 3 banana
22
2715
kcdoell
by: kcdoell | last post by:
I have been trying for the last several days to create a query that will give me all of the values I need to create a report. Background: The report is different than anything I have done but I am hoping that for someone out there has. Visually it looks like the following: Product Name__Week 1__Week 2__Week 3__Week 4__Week 5__BudgetGWP__PriorGWP Product 1________45______56_______0_______0_______12_______300_________250__ Product...
14
7838
ollyb303
by: ollyb303 | last post by:
Hi, I am trying to create a dynamic crosstab report which will display number of calls handled (I work for a call centre) per day grouped by supervisor. I have one crosstab query (Query1) which has the following fields: SPID (supervisor ID), total:group by, as row heading Date, total:group by, as column heading Calls handled, total:sum, as value Date, total:where, criteria between and - this is taken from a form,
0
8262
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8196
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8701
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8637
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8502
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7192
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5571
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4196
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2623
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.