Setting up %'s in table

D

DCost

How would I set up percentages in a table? What should I
set the Data Type, Field Size, Format & decimal places if
I would like it to be entered as 12.99% for example.
 
S

SF

In your data type of your field it would be "number". In
format of that field select "percent". Below at decimal
places, select the one you want.As far as "field size",
long integrer should work well. HTH.
 
M

Marshall Smith

Long Integer does NOT work. Percentages are, pretty much by definition,
fractions. You need the Field Size to be either Single or Double.

HTH,

Marshall Smith
Project Developers, Inc.
 
T

Tim Ferguson

In your data type of your field it would be "number". In
format of that field select "percent".

Bear in mind that what looks like 12.99% is actually a value of 0.1299, and
it has to be entered like that. This can be (a) confusing and (b) a pain
for users.
Below at decimal
places, select the one you want.As far as "field size",
long integrer should work well.

As Marshall points out, an Integer will not work at all well for values
that require fractions.

Depending on what the OP wants to do with the number, I would normally
advise scaling the number by 100, so that the user actually types in 12.99
rather than 0.1299 and that is what gets stored in the table.

On the form, place a label control with "%" as the caption, just to the
right of the text box so that it is clear what the contents mean.

Tax percent [.........] %

Then, when it comes to calculate stuff using the value, remember to divide
by 100:

currTotal = FinalPrice * (1.0 + TaxPC / 100.0)

and so on. This seems to me to be the most natural way of presenting it.

All the best


Tim F
 

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