Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

decimal to fraction conversion

Posted on 1998-06-24
1
Medium Priority
?
358 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 800 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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

Explore the ways to Unlock VBA Project Password Excel 2010 & 2013 documents. Go through the article and perform the steps carefully to remove VBA Excel .xls file.
Windows Explorer lets you open cabinet (cab) files like any other folder. In VBA you can easily handle normal files and folders, but opening and indeed creating cabinet files takes a lot more - and that's you'll find here.
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Suggested Courses

916 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