entering fractions

W

wendysand

I am looking to create a field for ad space that I can enter a few simple
fractions into (i.e. 1, 1/2, 1/3, 1/4, 2/3) for ad space size that I can add
in queries. It seems that is a lot trickier than it should be. I would
rather not convert to or from decimals if possible with the .3333333.....
issue. Thanks for help anyone out there.
 
K

Klatuu

Just use a text field and when working with the values, be sure you enclose
them in quotes where necessary so you don't end up with numbers.
 
J

Jerry Whittle

If you are going to actually use these fractions to do math, you'll need two
fields in the table.

TheDivisor field would be the "bottom" of the fraction.
TheNumerator field would be the "top" of the fraction.

You could then divide the numerator by the divisor in queries, forms, and
reports.

If you just want to see the fraction, Klatuu/Dave's suggestion of a text
field would work best.
 
M

Monkey Butler

I am looking to create a field for ad space that I can enter a few simple
fractions into (i.e. 1, 1/2, 1/3, 1/4, 2/3) for ad space size that I can add
in queries.  It seems that is a lot trickier than it should be.  I would
rather not convert to or from decimals if possible with the .3333333.....
issue.  Thanks for help anyone out there.

I ran into a similar problem. Base ten numbering doesn't work in your
situation.

If you break down your page into units equal to the least common
denominator of your fractions then you can create a "Units table to
store useful numbers that you can do calcualtions with. Given the
fractions you gave a page with twelve "units" would work. If you
included 1/8ths then 24 units per page would be required.

I created a "Units" table.

tblUnits
--------------
ID - pk
UnitName
UnitSize

ID UnitName UnitSize
1 1/4 3
2 1/3 4
3 1/2 6
4 2/3 8
5 3/4 9
6 1 12

Now you can do math so that if you have two ID 1's and one ID 3 then
3+3+4 = 12

And 12/12 = 1 page.

HTH

Steve P
 
C

Clifford Bass

Hi Wendy,

And a variation on Jerry's suggestion: If you only have a few fractions
(5, 10, 20, 50?) you might set up a lookup table:

FractionID Numerator Denominator
1 1 2
2 1 3
3 2 3

And so on...

Then use a combo box on your form that uses this as the source:

select FractionID, Numerator & "/" & Denominator As FractionText
from tblFractions
order by ????

Hide the first column and display only the second.

If you need to use the values when the fraction is chosen, you could
add the Numerator and the Denominator as a third and fourth column; hiding
them also. Then you could get to the values using the Column() property.

If needing the values in a query simply join to the fractions table.

Clifford Bass
 

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