473,473 Members | 1,853 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Dropping Zeros in a crosstab query

kcdoell
230 New Member
I have a listbox on a form that uses my crosstab query to display the query results. For the fields that display numbers, the numbers with a zero in the last digit are being dropped. Example $88.80 is displayes as $88.8. I have the field set as a numeric/double. The interesting thing is that the raw data file has the zeros on the end. I am thinking I need to resolve the formating issue in the query itself.

Does anybody have any ideas?
Dec 26 '07 #1
10 2008
jaxjagfan
254 Recognized Expert Contributor
I have a listbox on a form that uses my crosstab query to display the query results. For the fields that display numbers, the numbers with a zero in the last digit are being dropped. Example $88.80 is displayes as $88.8. I have the field set as a numeric/double. The interesting thing is that the raw data file has the zeros on the end. I am thinking I need to resolve the formating issue in the query itself.

Does anybody have any ideas?
For those columns in your listbox you want to display as currency - CCur(yourcolumnname) and it should display $88.80.
Dec 26 '07 #2
kcdoell
230 New Member
For those columns in your listbox you want to display as currency - CCur(yourcolumnname) and it should display $88.80.
Do I have to go into the properties of the listbox to do this? If not, how would I accomplish this? Thanks a lot

Keith.
Dec 26 '07 #3
jaxjagfan
254 Recognized Expert Contributor
Do I have to go into the properties of the listbox to do this? If not, how would I accomplish this? Thanks a lot

Keith.
In the Rowsource property of the listbox edit the the rowsource similar to the following:

SELECT qryYourCrosstab.Column1, qryYourCrosstab.Column2, CCur(qryYourCrosstab.Column3) AS YourCurrencyCol FROM qryYourCrosstab;

Hope this helps!
Dec 26 '07 #4
kcdoell
230 New Member
I tried the following:

SELECT qry1DataTable_Crosstab_Ordered.Column1, qry1DataTable_Crosstab_Ordered.Column2, CCur(qry1DataTable_Crosstab_Ordered.Column3) AS DetailAmt FROM qry1DataTable_Crosstab_Ordered;

but it did not work. The way I have it set up now I have "row/source type" set to table/Query and "row source" to the name of the query "1DataTable_Crosstab_Ordered". I tried to manipulate your suggestion but then the list box does not pull the query in.... and displays blank......

Keith
Dec 26 '07 #5
jaxjagfan
254 Recognized Expert Contributor
I tried the following:

SELECT qry1DataTable_Crosstab_Ordered.Column1, qry1DataTable_Crosstab_Ordered.Column2, CCur(qry1DataTable_Crosstab_Ordered.Column3) AS DetailAmt FROM qry1DataTable_Crosstab_Ordered;

but it did not work. The way I have it set up now I have "row/source type" set to table/Query and "row source" to the name of the query "1DataTable_Crosstab_Ordered". I tried to manipulate your suggestion but then the list box does not pull the query in.... and displays blank......

Keith
Replace "1DataTable_Crosstab_Ordered" with your SELECT statement. Replace the Column1,Column2,etc with the names from your crosstab query columns (Unless those are the names you gave the columns. I don't know how many columns you are trying to display here so you may need to include more or less columns) Yes - rowsource type should be set to table/query.

In the RowSource property you can bring up the QBE (query designer) by clicking on the "..." and selecting your crosstab query along with the desired fields (columns). On the field you wish to display as currency:

DetailAmt:CCur(qry1DataTable_Crosstab_Ordered.thef ieldname)
Dec 26 '07 #6
kcdoell
230 New Member
So far I still can not get the zero to display. I am thinking that it has something to do with the way my tables may be set up..... I have a table (My main table) that has a text field called “DetailDesc”. That field is linked to another field “EorDName” on a separate table. The user can add various “EorDName”, so currently there are about 20 different EorDName to choose from on a drop down list. It is these EorDName fields that are being displayed on my listbox that are not showing the last zero. Could that be the cause of the problem?? I noticed that my calculated field (Net Salary) on my query that is not tied to DetailDesc does display the last zero.....

Here is the crosstab query in SQL view:

PARAMETERS [Forms].[ChooseEmply].[ChooseEmployee] Text ( 255 ), [Forms].[ChooseEmply].[ChoosePayrollYear] Text ( 255 );
TRANSFORM CCur(Sum(DataTable.DetailAmt)) AS SumOfDetailAmt
SELECT DataTable.Month, CCur(Sum(DataTable.DetailAmt)) AS [Net Salary]
FROM DataTable
WHERE (((DataTable.EmployeeID)=Forms.ChooseEmply.ChooseE mployee) And ((Right([Month],2)) Like Right(Forms.ChooseEmply.ChoosePayrollYear,2)))
GROUP BY DataTable.Month
PIVOT DataTable.DetailDesc;

Best regards,

Keith.
Jan 3 '08 #7
jaxjagfan
254 Recognized Expert Contributor
So far I still can not get the zero to display. I am thinking that it has something to do with the way my tables may be set up..... I have a table (My main table) that has a text field called “DetailDesc”. That field is linked to another field “EorDName” on a separate table. The user can add various “EorDName”, so currently there are about 20 different EorDName to choose from on a drop down list. It is these EorDName fields that are being displayed on my listbox that are not showing the last zero. Could that be the cause of the problem?? I noticed that my calculated field (Net Salary) on my query that is not tied to DetailDesc does display the last zero.....

Here is the crosstab query in SQL view:

PARAMETERS [Forms].[ChooseEmply].[ChooseEmployee] Text ( 255 ), [Forms].[ChooseEmply].[ChoosePayrollYear] Text ( 255 );
TRANSFORM CCur(Sum(DataTable.DetailAmt)) AS SumOfDetailAmt
SELECT DataTable.Month, CCur(Sum(DataTable.DetailAmt)) AS [Net Salary]
FROM DataTable
WHERE (((DataTable.EmployeeID)=Forms.ChooseEmply.ChooseE mployee) And ((Right([Month],2)) Like Right(Forms.ChooseEmply.ChoosePayrollYear,2)))
GROUP BY DataTable.Month
PIVOT DataTable.DetailDesc;

Best regards,

Keith.
1. Drop Down List (ComboBox) and List box (ListBox) are 2 different types of controls. Combo allows user to pick one value at a time or enter their own depending on settings. ListBox allows user to pick one or more values depending on settings. I think you are using a drop list (combobox) to display a list of values (EorDName) to pick from or allowing users to enter a value and then filtering or using that value to navigate your records.
2. According to your description of the linking you are doing EorDName is a Text datatype that your users enter into a table.
3. Make a query with your parameters or criteria and then make a crosstab_query based on the parameter query.
4. Is it EorDName from your droplist that is not displaying the correct format or DetailDesc in the crosstab?
5 How are you displaying the results of the crosstab - in a datagrid, listbox, continuous form, etc?
6. How are you using this value when entered or selected?

The rowsource of your combo could be:

SELECT DataTable.DetailDesc
FROM DataTable
Group By DetailDesc
Order By DetailDesc;

This would give the user a unique list of the DetailDesc values in ascending order to pick from without having to maintain another table (If that is the purpose of the table EorDName is stored in).
Jan 3 '08 #8
kcdoell
230 New Member
Happy New Year!

On my main form is a listbox which is displaying the crosstab query result (Data tab on the properties of the listbox). To the end user it looks like a table on the form. The number of columns and rows are dependent on the crosstab query result. The User can add various EorDNames (ComboBox) to a record which are linked to DetailDesc hence why some records will have more columns than others when displayed on the listbox. The fields DetailDesc (Text) and DetailAmt (Currency) are on the same table, so any specific EorDName will have a DetailAmt associated with it. Those are the numbers in which I am seeing that if the last digit is a zero the listbox will not display it even though the zeros are displayed in the crosstab query and the raw datafile…..

Hope this all makes sense….

Thanks,

Keith.
Jan 3 '08 #9
jaxjagfan
254 Recognized Expert Contributor
I have a listbox (lstDetails) and a Combobox (cboEorDName)

In design view of the form I selected the lstDetails, view Properties, select Data tab - RowSourceType = Table/Query
Now in RowSource I select the button with the (...) which opens the query builder to build a row source. I select my crosstab query and then select the fields I want displayed.
In the criteria section of the Details field I put [cboEorDName] and in the DetailAmt column where I want a currency value to be displayed I edit it to say Amt: CCur(DetailAmt)

I then close (not save) the query - when prompted to update properties select "Yes". This will put the SQL equivalent of a query based on the Crosstab query in lstDetails row source.

On the AfterUpdate Property of cboEorDName I would put the following code:

Me.lstDetails.Requery

In the event my Amt column still isn't displaying correctly I would consider changing it to Amt: Format(DetailAmt,"Currency")
Jan 3 '08 #10
kcdoell
230 New Member
Solved in the end, I conducted several experiments rebuilding the query, rebuilding the list box from scratch and making sure my DetailAmt was set to currency....... In the end going through that process all over again solved the problem. It ended up just being a conflict with the DetailAmt not being set to Currency as well as me cleaning up my crosstab query....

Thanks for your input and help

Keith.
Jan 3 '08 #11

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

Similar topics

1
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...
2
by: Sherman H. | last post by:
I have a few questions for crosstab and popup form questions: 1. I created a crosstab as follows: IT Financial Operation John 21 22 ...
4
by: Judy | last post by:
I'm using Access 2003 and was wondering if it is possible to have a paramater selection within a crosstab query so that I wouldn't need to build a new table. I have a select query that I'm using...
7
by: newguy | last post by:
I am trying to get the totals of a table by client by type of income. This query will get what I am looking for with each unique combination as a row: SELECT Sales.Client, BillCode.Type,...
12
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...
8
by: Penny | last post by:
(Access 2003 Multiuser Split DB, Windows XP Pro) Hi All, I would really appreciate just some basic tips on how to make a Crosstab Form based on a Crosstab Query. The query always has the same...
14
by: Tina | last post by:
My employer tracks productivity/performance of clinicians (how much they bill) each week, its averages for the month, and the 6 months. These averages are compared to their expected productivity....
27
by: Bob | last post by:
running access 2k; mdb w/ linked tables to another mdb (front/back-end); trying to run a query that updates a table FROM information from a crosstab query. I AM NOTT trying to update the...
4
by: m.wanstall | last post by:
I have a crosstab query that compiles data for Months of the year. I have a stacked select query on top of that crosstab query that uses the latest 2 months data and exports it to a fixed length...
0
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,...
0
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,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...
0
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,...
0
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...
0
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 ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.