W
woods in me
is it possible to format a table column in Access as a fraction, like in
Excel. is so how?
Excel. is so how?
woods in me said:is it possible to format a table column in Access as a fraction, like in
Excel. is so how?
Arvin Meyer said:No. You would use a string data type, the use a function like the
following in the AfterUpdate event of a form's text box:
Use it like:
Sub txtMyText_AfterUpdate()
txtMyText = FractionIt(txtMyText)
End Sub
Public Function FractionIt(dblNumIn As Double) As String
Clif McIrvin said:Arvin, I'm having a bit of trouble following how this would work (Nice,
simple code in the function, BTW.)
Questions below:
Isn't there a type conflict between the dblNumIn as Double and the
txtMyText in the call?
Also, are you saying that Access will recognize a string like "8 3/4" as
the numerical value 8.75? Or, perhaps more properly, it will correctly do
a type conversion form 8 3/4 to 8.75?
In the brief testing I just did (2003 SP3) the type conversion ended up
with two numbers: 8, and 0.75 (?8 3/4 in the debug window, ?"8 3.4" did no
conversion.)
I tried defining both a string and variant variable and calling your
FractionIt and got a type mismatch error both times.
If passing a string literal, it requires the double quotes:
?fraction2number("8 3/4")
8.75