I plugged your code into an Access2019 db, and followed your instructions...it works beautifully, THANKS!I have a function that will convert a decimal number into a fraction, but the output is a string, not a number. The output is accurate to 1/128th of an inch.
'*******************Begin Code******************
Public Function DecimalToFraction(x)
Dim Temp As String
Dim Fixed As Double
If (VarType(x) < 2) Or (VarType(x) > 6) Then
DecimalToFraction = x
Else
x = Abs(x)
Fixed = Int(x)
If Fixed > 0 Then
Temp = str(Fixed)
End If
Select Case x - Fixed
Case Is < 0.007813
If Fixed > 0 Then
Temp = Temp
Else
Temp = str(x)
End If
Case 0.007813 To 0.023438
Temp = Temp + " 1/64"
Case 0.023438 To 0.039063
Temp = Temp + " 1/32"
Case 0.039063 To 0.054688
Temp = Temp + " 3/64"
Case 0.054688 To 0.070313
Temp = Temp + " 1/16"
Case 0.070313 To 0.085938
Temp = Temp + " 5/64"
Case 0.085938 To 0.101563
Temp = Temp + " 3/32"
Case 0.101563 To 0.117188
Temp = Temp + " 7/64"
Case 0.117188 To 0.132813
Temp = Temp + " 1/8"
Case 0.132813 To 0.148438
Temp = Temp + " 9/64"
Case 0.148438 To 0.164063
Temp = Temp + " 5/32"
Case 0.164063 To 0.179688
Temp = Temp + " 11/64"
Case 0.179688 To 0.195313
Temp = Temp + " 3/16"
Case 0.195313 To 0.210938
Temp = Temp + " 13/64"
Case 0.210938 To 0.226563
Temp = Temp + " 7/32"
Case 0.226563 To 0.242188
Temp = Temp + " 15/64"
Case 0.242188 To 0.257813
Temp = Temp + " 1/4"
Case 0.257813 To 0.273438
Temp = Temp + " 17/64"
Case 0.273438 To 0.289063
Temp = Temp + " 9/32"
Case 0.289063 To 0.304688
Temp = Temp + " 19/64"
Case 0.304688 To 0.320313
Temp = Temp + " 5/16"
Case 0.320313 To 0.335938
Temp = Temp + " 21/64"
Case 0.335938 To 0.351563
Temp = Temp + " 11/32"
Case 0.351563 To 0.367188
Temp = Temp + " 23/64"
Case 0.367188 To 0.382813
Temp = Temp + " 3/8"
Case 0.382813 To 0.398438
Temp = Temp + " 25/64"
Case 0.398438 To 0.414063
Temp = Temp + " 13/32"
Case 0.414063 To 0.429688
Temp = Temp + " 27/64"
Case 0.429688 To 0.445313
Temp = Temp + " 7/16"
Case 0.445313 To 0.460938
Temp = Temp + " 29/64"
Case 0.460938 To 0.476563
Temp = Temp + " 15/32"
Case 0.476563 To 0.492188
Temp = Temp + " 31/64"
Case 0.492188 To 0.507813
Temp = Temp + " 1/2"
Case 0.507813 To 0.523438
Temp = Temp + " 33/64"
Case 0.523438 To 0.539063
Temp = Temp + " 17/32"
Case 0.539063 To 0.554688
Temp = Temp + " 35/64"
Case 0.554688 To 0.570313
Temp = Temp + " 9/16"
Case 0.570313 To 0.585938
Temp = Temp + " 37/64"
Case 0.585938 To 0.601563
Temp = Temp + " 19/32"
Case 0.601563 To 0.617188
Temp = Temp + " 39/64"
Case 0.617188 To 0.632813
Temp = Temp + " 5/8"
Case 0.632813 To 0.648438
Temp = Temp + " 41/64"
Case 0.648438 To 0.664063
Temp = Temp + " 21/32"
Case 0.664063 To 0.679688
Temp = Temp + " 43/64"
Case 0.679688 To 0.695313
Temp = Temp + " 11/16"
Case 0.695313 To 0.710938
Temp = Temp + " 45/64"
Case 0.710938 To 0.726563
Temp = Temp + " 23/32"
Case 0.726563 To 0.742188
Temp = Temp + " 47/64"
Case 0.742188 To 0.757813
Temp = Temp + " 3/4"
Case 0.757813 To 0.773438
Temp = Temp + " 49/64"
Case 0.773438 To 0.789063
Temp = Temp + " 25/32"
Case 0.789063 To 0.804688
Temp = Temp + " 51/64"
Case 0.804688 To 0.820313
Temp = Temp + " 13/16"
Case 0.820313 To 0.835938
Temp = Temp + " 53/64"
Case 0.835938 To 0.851563
Temp = Temp + " 27/32"
Case 0.851563 To 0.867188
Temp = Temp + " 55/64"
Case 0.867188 To 0.882813
Temp = Temp + " 7/8"
Case 0.882813 To 0.898438
Temp = Temp + " 57/64"
Case 0.898438 To 0.914063
Temp = Temp + " 29/32"
Case 0.914063 To 0.929688
Temp = Temp + " 59/64"
Case 0.929688 To 0.945313
Temp = Temp + " 15/16"
Case 0.945313 To 0.960938
Temp = Temp + " 61/64"
Case 0.960938 To 0.976563
Temp = Temp + " 31/32"
Case 0.976563 To 0.992188
Temp = Temp + " 63/64"
Case Is > 0.992188
Temp = str(Int(x) + 1)
End Select
DecimalToFraction = Temp
End If
End Function
'*******************End Code******************
HTH
RDH
[This message has been edited by R. Hicks (edited 02-11-2001).]