Microsoft Access automatically rounds numbers - ms-access

Under a column that has a number data type. I am trying to enter the number 11.50, but the system is automatically changing it to 12.00.

because this type numbers can handle only numbers with out any fractions
you must change this datatype to be double

There are two settings for Number fields Field Size and Decimal Places. At first, you should change Field Size from Integer to either single, double.

When you have the table open in design mode, click on the field in question. In the lower pane you will see properties of the number, change the field size to either Single or Double.

Related

Rounding Off in SSRS field

In one of my columns in SSRS, I have the expression as
=ROUND(Fields!Contribution_Margin_.Value,5) & "%"
As you can see I am hardcoding the percent symbol after rounding off the value till decimals. But the issue is that the user wants to see only 2 decimals in the SSRS report and when he export it to excel he want 5 decimals while clicking on that particular cell.
So I went into Text box properties and in the Number section, I rounded off to 2 but it is not happening as I am having the "%" symbol, in the end, so after this also it is giving me till 5 decimals in the report.
Any solution how to make it to 2 decimal places in SSRS.
Don't mix value and display - leave the value as is (instead of turning the Value property into a string with the format hard coded into it, thereby losing precision and type) and use the display properties to show that value in the precision required.
Make the cell value just be the field value: Fields!Contribution_Margin_.Value. This allows it to be exported as a number rather than text.
Set the Format property of the cell to display percentage to two decimal places: p2
When exported to Excel, the full field value will be there and the client can format it to 5 decimal places.

Mysql datatype for money

i was trying to create a money related app in which users can choose their currency. Mysql datatype i tried is decimal(19,4). Now the problem is few currencies need three precisions and some need two
Eg:
oman rial needs three precisions. ie 1000 baisa = 1 omani rial. Hence my customers may enter 6.783 omani rial.
Where as my US customers will need only 2 precisions as 100 cents = 1 dollar and they may enter 5.50.
When i insert these two entries to my database using decimal(19,4), it is saved as 6.7830 and 5.5000 respectively.
Now the real pain is when i need to display their entrys as i dont want to display that extra 0 in omani rial entry and that 00 in US dollar. I also tried float but last digit gets rounded off at times.
Is there any mysql data type in which i can save exact entry as it is without any rounding off or extra zeros? If there is no such entry, how can i make it ppssible?
You can use VARCHAR to store exact representations, but I don't recommend that because it takes more bytes to store a number as a string. And any arithmetic you do on the value will convert it to a number anyway.
I recommend you use DECIMAL(19,4), and then format the value in application code, to display it with the appropriate digits. Every programming language has some function like printf() that allows you to control the output formatting, regardless of the value stored.

JPA / MySQL Decimal displayed in wrong way

I want to persist a sum of double values as Decimal(4,2) in my database and display it to the user. The issue I have is, that the decimal number is stored correctly in my database with two decimal digits. But when querying it from the database in some cases it displays a lot more decimal digits to the user.
In my Entity class I have:
#Column(name="weight_sum", precision=6, scale=2)
private double weightSum;
In my MySQL Database I have a column specified as
Decimal (4,2)
I don't understand where I made the mistake.
Actually you are doing correct things but you need to do some more stuff.
If you have define precision and scale for weightSum of entity class then it will save into db accordingly.
But when you get back data from db and bind to corresponding entity class then it will again take default scale(actual scale following by zero) and precision value.
So whenever you send data to end user you need to set scale as-
weightSum.setScale(2, BigDecimal.ROUND_FLOOR);
In above method 2nd parameter is roundingMode, you should select roundingMode as per your requirement.
I hope it will help you out. Thanks

MS Access when linking I get an strange field number

When linking CSV files to MS Access 2007 I get some fields with #NUM!
Why do I get this?
I was thinking that it is probably because I have fields with the following numbers 9999999999 and the data type i use is _long Integer_, but how can I get the actual number?
Is it probably because I have fields with the following numbers 9999999999 the data type i use is long Integer
Yes. The largest positive value that will fit in a Long Integer column is
2,147,483,647
so
9,999,999,999
won't fit. You will either need to change the column type to
Field size: Decimal
Precision: 10
Scale: 0
or store the values as Text.

MS Access, number formatting

I need to display a number (real), ie 1234.567 like "1.234,56" or "1,234.56". I know that I have to use Format() but I can't figure it out. (It's for a textbox where the 'Control Source' property is set to some number field)
This should do it:
Format(number, "#,##0.00")
Where the actual separators used depend on the current locale setting.
Below method worked for me in ms access 2000-2003.
You should make changed in Table and in reports.
Table.
Go to the required field, Change data type to Nnmber, Field size to Decimal, Format to Standard.
Report.
Select the control where you want the thousand separator, select properties the format Select standard,, Decimal places 2.