By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,117 Members | 1,714 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,117 IT Pros & Developers. It's quick & easy.

Table Field Rounding

P: 58
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.
Oct 30 '06 #1
Share this Question
Share on Google+
9 Replies


MMcCarthy
Expert Mod 10K+
P: 14,534
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.
Oct 30 '06 #2

NeoPa
Expert Mod 15k+
P: 31,429
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.
Oct 31 '06 #3

southoz
P: 24
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
Oct 31 '06 #4

NeoPa
Expert Mod 15k+
P: 31,429
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.
Oct 31 '06 #5

PEB
Expert 100+
P: 1,418
PEB
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
Nov 4 '06 #6

NeoPa
Expert Mod 15k+
P: 31,429
We don't have that problem over here PEB ;).
What about the C functions (CInt; CDbl; CLng; etc)? Do they handle ',' & '.' properly?
Nov 4 '06 #7

PEB
Expert 100+
P: 1,418
PEB
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()?

;)
Nov 4 '06 #8

NeoPa
Expert Mod 15k+
P: 31,429
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.
Nov 4 '06 #9

PEB
Expert 100+
P: 1,418
PEB
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()

:)
Nov 4 '06 #10

Post your reply

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