Solved

decimal to fraction conversion

Posted on 1998-06-24
1
321 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

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

777 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