CAN'T ?!?!?
They told Michael Jordan, "You CAN'T play baseball."
They told Bob Dole, "You CAN'T be President."
Well... OK, not the best examples, but look at the endorsements they get!
The fact is, Steve, it is frivolous. Fractions are simple. But you see, that's why we use them to begin teaching our kids basic math. And, there will be times when our apps are used by people who have not gone very far beyond basic math.
I think it's very unlikely that anyone needing to use fractions will require pin-point accuracy to the n
th decimal place.
They say that the guy who started Dial-A-Mattress was on the verge of bankruptcy in the early days because no one seemed willing to dial 1-800-MATTRESS to buy a bed. Before he gave in to the people who said, "You CAN'T sell beds over the phone", he leased more phone numbers:
1-800-MATRESS, 1-800-MATTRIS,
and every other mis-spelling of Mattress he could think of. The phones haven't stopped ringing.
I think it's all about knowing your audience. So.... for those of us who may have an audience that demands fractions, (like my six year old daughter) here's a pretty painless way to make the substitutions.
1.) Build a new table with two fields.
table name: tblFractions
field1: intDecimal (Double)
field2: strFraction (Text)
2.) Open Excel and type the following into the respective cells:
A1 1
A2 2
B1 1000
C1 = A1/B1
D1 = LCM(B1,A1)/1000
E1 = A1/D1
F1 = B1/E1
G1 = D1&"/"&F1
Select A1 & A2 and Drag Down to Row 999. Fill or Drag the other cells down to Row 999.
{Note: if you get #Name# error on the LCM function, check help forinstructions on selecting the correct add-in.}
Column A will have the numbers 1 - 999.
Column B 1000 in all cells
Column C will have values .001 through .999
Column D has the Lowest Common Multiplier of A & B (divided by 1000 to determine the fraction's Numerator)
Column E identifies the divisor to achieve the lowest common denominator.
Column F gives you the lowest common denominator, and
Column G creates the fraction string.
Column C contains decimal values and Column G contains their fractional equivalents. Copy these two Columns and Paste Special > Values into Columns A and B on another worksheet. Select the populated cells (A1:B999) and Copy to Clipboard.
3.) Return to Access and paste the data into tblFractions.
4.) Using a form with Text4, Text10, and Command1, paste the following code into the Click event for Command1:
Code:
Private Sub Command1_Click()
Dim frmFraction As Variant, frmDecimal As Double
frmDecimal = Mid(Text4, (InStr(Text4, ".")), 4)
frmFraction = DLookup "[strFraction]", "tblFractions","[intDecimal] LIKE " & frmDecimal)
Text10 = Left(Text4, (InStr(Text4, ".") - 1)) & " " & frmFraction
End Sub
5.) Type a number (eg: '435.605') in Text4 and Click Command1. Text10 displays
435 121/200.
John
Use what you have,
Learn what you can,
Create what you need.