Solved

decimal to fraction conversion

Posted on 1998-06-24
1
303 Views
Last Modified: 2008-03-06
I need to convert decimal numbers to fractions in Access 97.
With Excel you can just format the cells is there a way to do it in Access?
0
Comment
Question by:Desrosiers
1 Comment
 
LVL 6

Accepted Solution

by:
devtha earned 200 total points
ID: 1975715
Function getpart (var As Double)

Dim var1 As String, var2 As String, var3 As String, var4 As String

var1 = Mid$(Str(var), 1, InStr(Str(var), ".") - 1)
var2 = Mid$(Str(var), InStr(Str(var), ".") + 1, 99)

Select Case var2
    Case "2"
        var3 = "1/5"
    Case "25"
        var3 = "1/4"
    Case "33"
        var3 = "1/3"
    Case "4"
        var3 = "2/5"
    Case "5"
        var3 = "1/2"
    Case "6"
        var3 = "3/5"
    Case "66"
        var3 = "2/3"
    Case "75"
        var3 = "3/4"
    Case "8"
        var3 = "4/5"
    Case Else
        Exit Function
End Select
MsgBox var3

End Function

See if this funcion solves your question.
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
ms/acceee link a subform to a control 9 25
Access 2010 3 18
Access Date Query 28 29
Loop within Select Case 3 25
I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now