Do number fields automatically round to whole number? Is there a way to stop it from rounding? I have tried setting the decimal places to 2 and it still rounds.
9 3066 MMcCarthy 14,534
Recognized Expert Moderator MVP
Do number fields automatically round to whole number? Is there a way to stop it from rounding? I have tried setting the decimal places to 2 and it still rounds.
Setting a field to a number is only the start of the process you must also set the Format. It sounds as if your numbers are formatted as Integers change to double and this should solve your problem.
NeoPa 32,556
Recognized Expert Moderator MVP
Yes, The default FieldSize of a number variable is Long Integer.
As Mary says, you need to set this property to Double to enable it to store decimal places.
Good ay ,
I had a simular problem an after a few hours of fustration i just chanced the field to
a textbox , then on calculations I just use temp2 = Val(Me!quantity)
been working fine ever since and saves all the hassles related to access numeric formats
southoz
NeoPa 32,556
Recognized Expert Moderator MVP
Good ay ,
I had a simular problem an after a few hours of fustration i just chanced the field to
a textbox , then on calculations I just use temp2 = Val(Me!quantity)
been working fine ever since and saves all the hassles related to access numeric formats
While that would work SouthOz, I wouldn't recommend it.
You're really much better off understanding what the problem really is about.
The field types can be your friends if you understand them.
PEB 1,418
Recognized Expert Top Contributor
Hi
Using the val funcion with decimals is very dangerous...
Coz If your decimal separator is a comma, so the decimal part of your number is rounded....
It works good only with the dot :)
Good ay ,
I had a simular problem an after a few hours of fustration i just chanced the field to
a textbox , then on calculations I just use temp2 = Val(Me!quantity)
been working fine ever since and saves all the hassles related to access numeric formats
southoz
NeoPa 32,556
Recognized Expert Moderator MVP
We don't have that problem over here PEB ;).
What about the C functions (CInt; CDbl; CLng; etc)? Do they handle ',' & '.' properly?
PEB 1,418
Recognized Expert Top Contributor
NeoPa change your regional settings to use the comma as decimal separator and try the val()
and tell me about the results
Easy way to do the test:
?val("123.32")
123,32
?val("123,32")
123
What is your conclusion about val()?
;)
NeoPa 32,556
Recognized Expert Moderator MVP
I mean - we don't have the problem because our regional settings AREN'T like yours on the continent.
I wasn't arguing with you - just a little joke ;).
I wouldn't argue with someone who has over 1,000 posts on the Leader Board (Congratulations).
-Adrian.
PEB 1,418
Recognized Expert Top Contributor
In fact the strange history when I've detecting this particularity of Val...
In all computers where I'm working my regional Settings are to use the point as decimal separator...
One time from a company that used my accountancy program called me and told me for error in the calculations...
Till i understand what was the reason for this error...
JUST THE VAL() That is doing wrong ROUND
SO FOR EVERYBODY WHO CHANGES THE REGIONAL SETTINGS! TAKE CARE ABOUT THE FUNCTION VAL()
:)
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Caesar Augustus |
last post by:
Hello Tom,
Long time listener, first time caller...
I have been working with vb code to automate a salary increase process
that not only rounds to the nearest penny but also rounds to the...
|
by: bhieb |
last post by:
Alright this is a new one to me. I have linked a table using ODBC to
our AS400. When I either open it directly or query it I get the
incorrect values for several fields. For example the query on...
|
by: Tony Williams |
last post by:
I have a form where the user inputs a series of figures into a number of
controls. After they've input the total (they don't want the program to
create the total) there is a check to make sure the...
|
by: Haas C |
last post by:
Hi all!
Is there anyway I can override a value in a calculated field on a
form? For example:
I have a form which displays the following fields based on a query:
Premium Due field has the...
|
by: simun.selak |
last post by:
Hi,
Inserting number 99999.99 into a FLOAT 17 16 field results in
9.99999900....5E+004 being inserted into the base.
What is confusing me is the digit 5 that appears at the end of the
number....
|
by: NEWSGROUPS |
last post by:
I have data in a table in an Access 2000 database that needs to be exported
to a formatted text file. For instance, the first field is an account number
that is formatted in the table as text and...
|
by: md |
last post by:
Hi
Does any body know, how to round a double value with a specific number
of digits after the decimal points?
A function like this:
RoundMyDouble (double &value, short numberOfPrecisions)
...
|
by: mfsforums |
last post by:
Hi,
Working with a database that's new to me and they have a make table
query that creates a variety of fields, a handful of which are
designated as datatype 'Number' to start. It is then...
|
by: jacob navia |
last post by:
Hi
"How can I round a number to x decimal places" ?
This question keeps appearing. I would propose the following
solution
#include <float.h>
#include <math.h>
|
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,...
|
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...
|
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...
|
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...
|
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,...
|
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...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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 ...
| |