Results 1 to 4 of 4
  1. #1
    New Lounger
    Join Date
    Jun 2005
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Display Fractions on Forms and Reports (Access 200

    We use fractions (example: 1/4, 3/16, 7/8) instead of their decimal equivalents (example: .25, .1875, .875). However I need to do calculations within queries. I only need the fraction view on forms and reports for users, but behind the scenes it can be in decimal format. The user needs to be able to enter data on the form in fraction view (1/4, 3/8). Can anyone help??? Basically the user can enter 1/4 and in the table it will be stored as .25, but when I print a report, I need to be to have it say 1/4 again.
    Thanks in advance.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Display Fractions on Forms and Reports (Access 200

    Unlike Excel, Access doesn't provide a fraction number format. One workaround would be to use two text boxes, one to enter the numerator and the other to enter the denominator. You can then use [numerator]/[denominator] for calculations.
    The sample database at ACC97: Neatcd97.mdb Available in Download Center contains functions for converting decimal numbers such as .25 to fractions such as 1/4.

  3. #3
    New Lounger
    Join Date
    Jun 2005
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Display Fractions on Forms and Reports (Access

    I am sorry, I should have provided more information. I can only have this as 1 field (Not seperate denominator and numerartor fields). I did have this code at one point, but I deleted it. by accident.

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Display Fractions on Forms and Reports (Access

    I suppose you could use an unbound text box for data entry and display purposes and a hidden text box bound to the number field. You'd need code to translate back and forth:
    - Code in the On Current event of the form to populate the display text box with a fractional representation of the number value. You could use code from the sample code database I provided a link to.
    - Code in the After Update event of the display text box to compute the number value and store it in the hidden text box. This should be relatively easy.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •