How do I input number in Access data type=number; format=percent

H

Help Visio!

I have set up a field, data type number, format= percent, but when I enter
the number 5, it comes up as 500% in the field on the table? if I try 0.05 =
nothing shows.. what do I need to do? Haven't used Access for about 6 years..
 
J

John... Visio MVP

Help Visio! said:
I have set up a field, data type number, format= percent, but when I enter
the number 5, it comes up as 500% in the field on the table? if I try
0.05 =
nothing shows.. what do I need to do? Haven't used Access for about 6
years..


I'm stumped to.

Supposedly, the percent format allows you to enter a number from 0 to 1 and
the number is then multiplied by 100 and a % sign is stuck on the end.

What appears to be happening is that the number is rounded BEFORE
multiplying and the the remainder is eliminated or rounded up. .49 goes to 0
and .5 goes to 1.

John...
 
J

John... Visio MVP

John... Visio MVP said:
I'm stumped to.

Supposedly, the percent format allows you to enter a number from 0 to 1
and the number is then multiplied by 100 and a % sign is stuck on the end.

What appears to be happening is that the number is rounded BEFORE
multiplying and the the remainder is eliminated or rounded up. .49 goes to
0 and .5 goes to 1.

John...


Okay, I changed the value from a Long Int to a Single and now it works.

I still find that behaviour wierd.

John...
 
J

John Spencer

Well, since an integer field cannot contain any number but a whole number (no
decimal portion) and percentages are fractional (they have a decimal) there is
no way to store percentages in an integer field.

Format changes how the value is displayed and has nothing to do with how the
information is stored.


John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County
 
J

John W. Vinson

I have set up a field, data type number, format= percent, but when I enter
the number 5, it comes up as 500% in the field on the table? if I try 0.05 =
nothing shows.. what do I need to do? Haven't used Access for about 6 years..

My guess is that you used the default Number datatype, which is Long Integer.
An Integer is by definition a whole number. Change it to Single or Double and
you'll be able to enter either 0.05 or 5% (though entering 5 will correctly
give you 500%).
 
J

John... Visio MVP

John Spencer said:
Well, since an integer field cannot contain any number but a whole number
(no decimal portion) and percentages are fractional (they have a decimal)
there is no way to store percentages in an integer field.

Format changes how the value is displayed and has nothing to do with how
the information is stored.


John Spencer
Access MVP 2002-2005, 2007-2008


Thanks John S & John V.

Put that way, it does make sense. For some reason I was equating Single with
Int. Too many langauges, too many data types.

John...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top